Skip to content

Commit a906383

Browse files
committed
NODE-507 Added returnNonCachedInstance option to db.db
1 parent 0211c59 commit a906383

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/db.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,7 @@ Db.prototype.addChild = function(db) {
975975
* @param {string} name The name of the database we want to use.
976976
* @param {object} [options=null] Optional settings.
977977
* @param {boolean} [options.noListener=false] Do not make the db an event listener to the original connection.
978+
* @param {boolean} [options.returnNonCachedInstance=false] Control if you want to return a cached instance or have a new one created
978979
* @return {Db}
979980
*/
980981
Db.prototype.db = function(dbName, options) {
@@ -985,7 +986,7 @@ Db.prototype.db = function(dbName, options) {
985986
}
986987

987988
// Do we have the db in the cache already
988-
if(this.s.dbCache[dbName]) {
989+
if(this.s.dbCache[dbName] && options.returnNonCachedInstance !== true) {
989990
return this.s.dbCache[dbName];
990991
}
991992

0 commit comments

Comments
 (0)