Update mongodb to the latest version 🚀 (#4449)

* fix(package): update mongodb to version 3.0.0

* Compatibility with MongoDB client 3.0

* Updates Gridstore as well

* Set Read preference to Primary when not specified, to match original implementation

* Update MongoStorageAdapter.js

* Bumps to 3.0.1
This commit is contained in:
greenkeeper[bot]
2017-12-30 00:23:43 -05:00
committed by Florent Vilmart
parent 6143988a82
commit f0f1870aa3
3 changed files with 35 additions and 26 deletions

View File

@@ -21,7 +21,8 @@ export class GridStoreAdapter extends FilesAdapter {
_connect() {
if (!this._connectionPromise) {
this._connectionPromise = MongoClient.connect(this._databaseURI);
this._connectionPromise = MongoClient.connect(this._databaseURI)
.then((client) => client.db(client.s.options.dbName));
}
return this._connectionPromise;
}
@@ -29,7 +30,7 @@ export class GridStoreAdapter extends FilesAdapter {
// For a given config object, filename, and data, store a file
// Returns a promise
createFile(filename: string, data) {
return this._connect().then(database => {
return this._connect().then((database) => {
const gridStore = new GridStore(database, filename, 'w');
return gridStore.open();
}).then(gridStore => {