A quick note to self and other alike on how to drop a database, backup a database and restore a database in MongoDB.
Just use the command db.dropDatabase() from the mongo command line client.
use db; db.dropDatabase();
To backup a local mongo databse Use the command line utility mongodump.
mongodump -d dbname
This would create a folder “dump” containing the dbname folder further containing all collections. Use this “dbname” folder to restore database.
To restore a backup, taken earlier using mongodump, use the command mongorestore.
mongorestore -d dbname Path_of_dump_folder
Where path of dump folder would be path till “dbname” folder from the mongodump example above.