I am running some integration tests with / w 630> .js Mongodb native driver. Each test includes connecting to a database, confirming that it does not exist yet (for example, there are no collections with documents), running the test and then deleting the database. The high-level code is as follows:
const runSafeTest = function runSafeTest(test) {
async.waterfall([
connectToMongo,
throwIfDbExists,
instantiateServerConnection,
test
],
function doneWaterfall(err, db) {
db.dropDatabase(function(dbErr) {
if (dbErr) throw dbErr
});
})
};
With each call, db.dropDatabase()
it produces the following error:
MongoError: topology was destroyed
, : "" MongoDB ? Mongo, SO, , " " .
!