diff --git a/test/tools/mongoDBUtils.js b/test/tools/mongoDBUtils.js index 5d6052f..a42195a 100644 --- a/test/tools/mongoDBUtils.js +++ b/test/tools/mongoDBUtils.js @@ -27,16 +27,16 @@ const async = require('async'); function cleanDb(host, name, callback) { const url = 'mongodb://' + host + ':27017/' + name; - MongoClient.connect( - url, - function(err, db) { - if (db) { - db.dropDatabase(); + /* eslint-disable-next-line no-unused-vars */ + MongoClient.connect(url, { useNewUrlParser: true }, function (err, db) { + if (db && db.db()) { + /* eslint-disable-next-line no-unused-vars */ + db.db().dropDatabase(function (err, result) { db.close(); - } - callback(); + callback(); + }); } - ); + }); } function cleanDbs(host, callback) {