Skip to content

Commit

Permalink
Fixed Mongo 2 database selection bug
Browse files Browse the repository at this point in the history
  • Loading branch information
devconcept committed Sep 24, 2018
1 parent 5580598 commit f4f99b5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ function compareUris(uri1, uri2) {
*/
function getDatabase(obj) {
// If the object has a db property should be a mongoose connection instance
if (obj.db) {
// Mongo 2 has a db property but its a function. See issue #14
if (obj.db && typeof obj.db !== 'function') {
return obj.db;
}
// If it has a connection property with a db property on it is a mongoose instance
Expand Down

0 comments on commit f4f99b5

Please sign in to comment.