Skip to content

Commit 2e8ab9f

Browse files
committed
Fixed Mongoclient.prototype.close bug where _db was missing
1 parent 361eaec commit 2e8ab9f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/mongodb/mongo_client.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ MongoClient.prototype.connect = function(url, options, callback) {
7878

7979
MongoClient.connect(url, options, function(err, db) {
8080
if(err) return callback(err, db);
81+
// Store internal db instance reference
82+
self._db = db;
8183
// Emit open and perform callback
8284
self.emit("open", err, db);
8385
callback(err, db);
@@ -97,7 +99,6 @@ MongoClient.prototype.open = function(callback) {
9799
// Open the db
98100
this._db.open(function(err, db) {
99101
if(err) return callback(err, null);
100-
101102
// Emit open event
102103
self.emit("open", err, db);
103104
// Callback

0 commit comments

Comments
 (0)