I’m doing development on MongoDB. For totally non-evil purposes, I sometimes want to blow away everything in a databasethat is, to delete every single collection, and whatever else might be lying around, and start from scratch. Is there a single line of code that will let me do this in MongoDB? Bonus points for giving both a MongoDB console method and a MongoDB Ruby driver method.
1
2
3
4
5
6
7
8
9
10
use [database];
db.dropDatabase();
Ruby code should be pretty similar.
Also, from the command line:
mongo [database] –eval “db.dropDatabase();”Use
[databaseName]
db.Drop+databaseName();
drop collection
use databaseName
db.collectionName.drop();