Update mongodb to the latest version 🚀 (#5914)
* fix(package): update mongodb to version 3.3.0 * chore(package): update lockfile package-lock.json * Fix tests * Fix GraphQL tests for read preference * Fix mongo adapter deprecation notice * Fix the way the connections are checked, return promise when shutting down mongo
This commit is contained in:
committed by
peril-parse-community[bot]
parent
6760ceb836
commit
4c1be61bed
@@ -146,6 +146,7 @@ export class MongoStorageAdapter implements StorageAdapter {
|
||||
this._collectionPrefix = collectionPrefix;
|
||||
this._mongoOptions = mongoOptions;
|
||||
this._mongoOptions.useNewUrlParser = true;
|
||||
this._mongoOptions.useUnifiedTopology = true;
|
||||
|
||||
// MaxTimeMS is not a global MongoDB client option, it is applied per operation.
|
||||
this._maxTimeMS = mongoOptions.maxTimeMS;
|
||||
@@ -203,9 +204,9 @@ export class MongoStorageAdapter implements StorageAdapter {
|
||||
|
||||
handleShutdown() {
|
||||
if (!this.client) {
|
||||
return;
|
||||
return Promise.resolve();
|
||||
}
|
||||
this.client.close(false);
|
||||
return this.client.close(false);
|
||||
}
|
||||
|
||||
_adaptiveCollection(name: string) {
|
||||
|
||||
@@ -117,8 +117,12 @@ class ParseServer {
|
||||
handleShutdown() {
|
||||
const { adapter } = this.config.databaseController;
|
||||
if (adapter && typeof adapter.handleShutdown === 'function') {
|
||||
adapter.handleShutdown();
|
||||
const promise = adapter.handleShutdown();
|
||||
if (promise instanceof Promise) {
|
||||
return promise;
|
||||
}
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user