From f4f99b5167545c263093821546fe2bb75981eab3 Mon Sep 17 00:00:00 2001 From: devconcept Date: Mon, 24 Sep 2018 15:56:04 -0500 Subject: [PATCH] Fixed Mongo 2 database selection bug --- lib/utils.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/utils.js b/lib/utils.js index 63377c47..1e6f1ff3 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -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