jjzjj

destroyDatabase

全部标签

node.js - 使用 node.js mongodb native 调用 db.destroyDatabase 时,什么会导致 "topology was destroyed"错误?

我正在使用Node.jsMongodbnative驱动程序运行一些集成测试。每个测试都涉及连接到数据库,验证它不存在(例如,没有任何带文档的集合),运行测试,然后删除数据库。高级代码如下:construnSafeTest=functionrunSafeTest(test){async.waterfall([connectToMongo,throwIfDbExists,instantiateServerConnection,test],functiondoneWaterfall(err,db){db.dropDatabase(function(dbErr){if(dbErr)throwd