I want to remove dirty data in the database (the database & the collections) , However the following code is not work ? How could I drop database with mongoose ?
console.log(uri) // uri = mongodb://localhost/dev
var db = mongoose.connect(uri,function(err){
if (err) console.log(err) // no err output
});
mongoose.connection.on('open', function(){ //db.connection is not work too .
mongoose.connection.db.dropDatabase(function(err){
console.log(err); // no err output
});
});
All my data and database are still not deleted .