Skip to content

Commit fb6b5f0

Browse files
author
Pavlova
committed
changed connection for mongodb ver 3.x
1 parent f820c13 commit fb6b5f0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,14 @@ var MongodbDriver = Base.extend({
290290
};
291291

292292
// Get a connection to mongo
293-
this.connection.connect(this.connectionString, function(err, db) {
293+
this.connection.connect(this.connectionString, function(err, mongoClient) {
294294

295295
if(err) {
296296
prCB(err);
297297
}
298298

299+
const db = mongoClient.db();
300+
299301
// Callback function to return mongo records
300302
var callbackFunction = function(err, data) {
301303

@@ -304,7 +306,7 @@ var MongodbDriver = Base.extend({
304306
}
305307

306308
prCB(null, data);
307-
db.close();
309+
mongoClient.close();
308310
};
309311

310312
// Depending on the command, we need to use different mongo methods

0 commit comments

Comments
 (0)