Skip to content

Commit df89adc

Browse files
feat(getDbInstance): moved from string based check to promise call
Signed-off-by: BorntraegerMarc [email protected]
1 parent 87c8170 commit df89adc

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,7 @@ var MongodbDriver = Base.extend({
305305
}
306306

307307
prCB(null, data);
308-
if (command !== 'getDbInstance') {
309-
db.close();
310-
}
308+
db.close();
311309
};
312310

313311
// Depending on the command, we need to use different mongo methods
@@ -360,7 +358,7 @@ var MongodbDriver = Base.extend({
360358
db.collection(collection)[command](options.query, options.update, options.options, callbackFunction);
361359
break;
362360
case 'getDbInstance':
363-
callbackFunction(null, db);
361+
prCB(null, db); // When the user wants to get the DB instance we need to retrun the promise callback, so the DB connection is not automatically closed
364362
break;
365363
default:
366364
db[command](collection, callbackFunction);

0 commit comments

Comments
 (0)