Skip to content

Commit

Permalink
Update mongojs to version 3 and switch legacy projections to false fo…
Browse files Browse the repository at this point in the history
…r version 3 (#33)
  • Loading branch information
saintedlama committed Oct 30, 2019
1 parent 07705c5 commit 225a63e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 62 deletions.
5 changes: 3 additions & 2 deletions lib/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,14 @@ module.exports = class Database extends EventEmitter {
});
} else if (typeof this.connectionString._getConnection === 'function') { // mongojs
return new Promise((resolve, reject) => {
this.connectionString._getConnection((err, connection) => {
this.connectionString._getConnection((err, connection, conn) => {
if (err) { return reject(err); }

this.connection = connection;

this.features = {
useLegacyProjections: true
// Third argument conn is only sent in mongojs 3
useLegacyProjections: !conn
};

this.emit('connect');
Expand Down
88 changes: 29 additions & 59 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"drop-mongodb-collections": "^1.2.5",
"eslint": "^6.5.1",
"mocha": "^6.2.1",
"mongojs": "^2.6.0",
"mongojs": "^3.0.0",
"nyc": "^14.1.1",
"standard-version": "^7.0.0"
}
Expand Down

0 comments on commit 225a63e

Please sign in to comment.