diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index 9837acc..4d8864c 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1,3 +1,4 @@ - Fix: replace git:// to https:// url for npm dependences - Fix: Dockerfile to include initial packages upgrade +- Upgrade mongodb dev dep from 3.5.9 to 4.7.0 - Upgrade NodeJS version from 14-slim to 16-slim in Dockerfile diff --git a/package.json b/package.json index 4957edb..a4917f1 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "husky": "~4.2.5", "lint-staged": "~10.2.11", "mocha": "8.0.1", - "mongodb": "3.5.9", + "mongodb": "4.7.0", "nock": "13.0.3", "nyc": "~15.1.0", "prettier": "~2.0.5", diff --git a/test/unit/mongoDBUtils.js b/test/unit/mongoDBUtils.js index e5f7fd8..fa2c2fd 100644 --- a/test/unit/mongoDBUtils.js +++ b/test/unit/mongoDBUtils.js @@ -30,39 +30,34 @@ function cleanDb(host, name, callback) { // FIXME: this code doesn't work with MongoDB replica set, we are assuming that an // standalone MongoDB instance is used to run unit test.To use a replica set this // needs to be adapted + // FIXME: not sure if the statement above is still valid after moving to mongodb 4.x. + // Maybe the limitation has been overpassed const url = 'mongodb://' + host + ':27017/' + name; - MongoClient.connect( - url, - { - useNewUrlParser: true, - connectTimeoutMS: 500 - }, - function(err, db) { - if (db) { - const collections = ['devices', 'groups', 'entities', 'registrations']; + MongoClient.connect(url, function (err, db) { + if (db) { + const collections = ['devices', 'groups', 'entities', 'registrations']; - async.eachSeries( - collections, - function(collection, innerCb) { - const collectionDB = db.db(name).collection(collection); - if (collectionDB) { - collectionDB.drop(function(err, delOK) { - innerCb(); - }); - } else { + async.eachSeries( + collections, + function (collection, innerCb) { + const collectionDB = db.db(name).collection(collection); + if (collectionDB) { + collectionDB.drop(function (err, delOK) { innerCb(); - } - }, - function(err) { - db.close(); - callback(); + }); + } else { + innerCb(); } - ); - } else { - callback(); - } + }, + function (err) { + db.close(); + callback(); + } + ); + } else { + callback(); } - ); + }); } function cleanDbs(host, callback) {