代码:
var connection = mongoose.createConnection('mongodb://localhost:9000/' + databaseName);
connection.db.dropDatabase(function(err){
// never reach this point!
debugger;
console.log(err);
console.log('-------------->Dropped database: ' + databaseName);
});
如果我做 connection.open 它表示它已经打开,并且同一连接不支持多次调用“打开”。
即使这样也行不通
var conn = mongoose.createConnection('mongodb://localhost',databaseName, 9000, {}, function(){
console.log('created'); // is reached
conn.db.dropDatabase(callback); // but the callback is not called anyway
});
问题是什么?("mongoose": "3.1.0") 数据库甚至没有被删除...谢谢