Update mongodb to the latest version 🚀 (#6348)
* fix(package): update mongodb to version 3.5.0 * chore(package): update lockfile package-lock.json * Fix shutdown issues Properly retrieves the number of connections https://docs.mongodb.com/manual/reference/command/serverStatus/#connections Bump to 3.5.1 * remove fit Co-authored-by: Diamond Lewis <findlewis@gmail.com>
This commit is contained in:
24
package-lock.json
generated
24
package-lock.json
generated
@@ -4643,6 +4643,11 @@
|
||||
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
|
||||
"integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o="
|
||||
},
|
||||
"denque": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/denque/-/denque-1.4.1.tgz",
|
||||
"integrity": "sha512-OfzPuSZKGcgr96rf1oODnfjqBFmr1DVoc/TrItj3Ohe0Ah1C5WX5Baquw/9U9KovnQ88EqmJbD66rKYUQYN1tQ=="
|
||||
},
|
||||
"depd": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
|
||||
@@ -9062,14 +9067,27 @@
|
||||
"integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg=="
|
||||
},
|
||||
"mongodb": {
|
||||
"version": "3.4.1",
|
||||
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.4.1.tgz",
|
||||
"integrity": "sha512-juqt5/Z42J4DcE7tG7UdVaTKmUC6zinF4yioPfpeOSNBieWSK6qCY+0tfGQcHLKrauWPDdMZVROHJOa8q2pWsA==",
|
||||
"version": "3.5.1",
|
||||
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.5.1.tgz",
|
||||
"integrity": "sha512-kpxt4/OfGZ3x9Py+c81yWARLFE3L5UDczF6319Xq0c+pp+8rrzqRiJKjhRAY261JorlRqtrpp7ROK2wCAMA4sw==",
|
||||
"requires": {
|
||||
"bl": "^2.2.0",
|
||||
"bson": "^1.1.1",
|
||||
"denque": "^1.4.1",
|
||||
"require_optional": "^1.0.1",
|
||||
"safe-buffer": "^5.1.2",
|
||||
"saslprep": "^1.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"bl": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/bl/-/bl-2.2.0.tgz",
|
||||
"integrity": "sha512-wbgvOpqopSr7uq6fJrLH8EsvYMJf9gzfo2jCsL2eTy75qXPukA4pCgHamOQkZtY5vmfVtjB+P3LNlMHW5CEZXA==",
|
||||
"requires": {
|
||||
"readable-stream": "^2.3.5",
|
||||
"safe-buffer": "^5.1.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"mongodb-core": {
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
"lodash": "4.17.15",
|
||||
"lru-cache": "5.1.1",
|
||||
"mime": "2.4.4",
|
||||
"mongodb": "3.4.1",
|
||||
"mongodb": "3.5.1",
|
||||
"node-rsa": "1.0.7",
|
||||
"parse": "2.11.0",
|
||||
"pg-promise": "10.4.0",
|
||||
|
||||
@@ -61,16 +61,20 @@ describe('GridFSBucket and GridStore interop', () => {
|
||||
await expectMissingFile(gfsAdapter, 'myFileName');
|
||||
});
|
||||
|
||||
it('handleShutdown, close connection', done => {
|
||||
it('handleShutdown, close connection', async () => {
|
||||
const databaseURI = 'mongodb://localhost:27017/parse';
|
||||
const gfsAdapter = new GridFSBucketAdapter(databaseURI);
|
||||
|
||||
gfsAdapter._connect().then(db => {
|
||||
expect(db.serverConfig.connections().length > 0).toEqual(true);
|
||||
gfsAdapter.handleShutdown().then(() => {
|
||||
expect(db.serverConfig.connections().length > 0).toEqual(false);
|
||||
done();
|
||||
});
|
||||
});
|
||||
const db = await gfsAdapter._connect();
|
||||
const status = await db.admin().serverStatus();
|
||||
expect(status.connections.current > 0).toEqual(true);
|
||||
|
||||
await gfsAdapter.handleShutdown();
|
||||
try {
|
||||
await db.admin().serverStatus();
|
||||
expect(false).toBe(true);
|
||||
} catch (e) {
|
||||
expect(e.message).toEqual('topology was destroyed');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -97,16 +97,20 @@ describe_only_db('mongo')('GridStoreAdapter', () => {
|
||||
.catch(fail);
|
||||
});
|
||||
|
||||
it('handleShutdown, close connection', done => {
|
||||
it('handleShutdown, close connection', async () => {
|
||||
const databaseURI = 'mongodb://localhost:27017/parse';
|
||||
const gridStoreAdapter = new GridStoreAdapter(databaseURI);
|
||||
|
||||
gridStoreAdapter._connect().then(db => {
|
||||
expect(db.serverConfig.connections().length > 0).toEqual(true);
|
||||
gridStoreAdapter.handleShutdown().then(() => {
|
||||
expect(db.serverConfig.connections().length > 0).toEqual(false);
|
||||
done();
|
||||
});
|
||||
});
|
||||
const db = await gridStoreAdapter._connect();
|
||||
const status = await db.admin().serverStatus();
|
||||
expect(status.connections.current > 0).toEqual(true);
|
||||
|
||||
await gridStoreAdapter.handleShutdown();
|
||||
try {
|
||||
await db.admin().serverStatus();
|
||||
expect(false).toBe(true);
|
||||
} catch (e) {
|
||||
expect(e.message).toEqual('topology was destroyed');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -271,7 +271,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('handleShutdown, close connection', done => {
|
||||
it('handleShutdown, close connection', async () => {
|
||||
const adapter = new MongoStorageAdapter({ uri: databaseURI });
|
||||
|
||||
const schema = {
|
||||
@@ -282,17 +282,17 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
|
||||
},
|
||||
};
|
||||
|
||||
adapter.createObject('MyClass', schema, {}).then(() => {
|
||||
expect(adapter.database.serverConfig.connections().length > 0).toEqual(
|
||||
true
|
||||
);
|
||||
adapter.handleShutdown().then(() => {
|
||||
expect(adapter.database.serverConfig.connections().length > 0).toEqual(
|
||||
false
|
||||
);
|
||||
done();
|
||||
});
|
||||
});
|
||||
await adapter.createObject('MyClass', schema, {});
|
||||
const status = await adapter.database.admin().serverStatus();
|
||||
expect(status.connections.current > 0).toEqual(true);
|
||||
|
||||
await adapter.handleShutdown();
|
||||
try {
|
||||
await adapter.database.admin().serverStatus();
|
||||
expect(false).toBe(true);
|
||||
} catch (e) {
|
||||
expect(e.message).toEqual('topology was destroyed');
|
||||
}
|
||||
});
|
||||
|
||||
it('getClass if exists', async () => {
|
||||
|
||||
@@ -106,7 +106,7 @@ describe('Server Url Checks', () => {
|
||||
parseServerProcess.on('close', code => {
|
||||
expect(code).toEqual(1);
|
||||
expect(stdout).toBeUndefined();
|
||||
expect(stderr).toContain('MongoNetworkError');
|
||||
expect(stderr).toContain('MongoServerSelectionError');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user