June 2014
Intermediate to advanced
696 pages
38h 52m
English
To delete a database from MongoDB, you need to get a Db object instance that points to that database. Then you call the dropDatabase() method on that object. It may take a while for MongoDB to finalize the deletion. If you need to verify that the deletion has occurred, you can use a timeout to wait for the database deletion to occur. For example:
newDB.dropDatabase(function(err, results){ <handle database deletion here>});
Read now
Unlock full access