refactor: Upgrade to mongodb 6.10.0 (#9362)

This commit is contained in:
Antoine Cormouls
2024-10-23 21:27:42 +02:00
committed by GitHub
parent 3a9442a42f
commit 7d8603f1c2
5 changed files with 248 additions and 405 deletions

View File

@@ -35,8 +35,6 @@ export class GridFSBucketAdapter extends FilesAdapter {
.substring(0, 32)
: null;
const defaultMongoOptions = {
useNewUrlParser: true,
useUnifiedTopology: true,
};
const _mongoOptions = Object.assign(defaultMongoOptions, mongoOptions);
for (const key of ['enableSchemaHooks', 'schemaCacheTtl', 'maxTimeMS']) {

View File

@@ -145,9 +145,7 @@ export class MongoStorageAdapter implements StorageAdapter {
this._uri = uri;
this._collectionPrefix = collectionPrefix;
this._mongoOptions = { ...mongoOptions };
this._mongoOptions.useNewUrlParser = true;
this._mongoOptions.useUnifiedTopology = true;
this._onchange = () => {};
this._onchange = () => { };
// MaxTimeMS is not a global MongoDB client option, it is applied per operation.
this._maxTimeMS = mongoOptions.maxTimeMS;
@@ -569,7 +567,7 @@ export class MongoStorageAdapter implements StorageAdapter {
session: transactionalSession || undefined,
})
)
.then(result => mongoObjectToParseObject(className, result.value, schema))
.then(result => mongoObjectToParseObject(className, result, schema))
.catch(error => {
if (error.code === 11000) {
throw new Parse.Error(