I'm doing development on MongoDB. For totally non-evil purposes, I sometimes want to blow away everything in a database—that 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? Bonus points for giving both a MongoDB console method and a MongoDB Ruby driver method.
Mongodb – Delete everything in a MongoDB database
mongodb
Related Topic
- MongoDB relationships: embed or reference
- Mongodb – How to drop a MongoDB database from the command line
- Mongodb – How to list all collections in the MongoDB shell
- Mongodb – How to rename a MongoDB database
- Mongodb – How to delete duplicates in MongoDb
- Mongodb – Find MongoDB records where array field is not empty
Best Answer
In the mongo shell:
And to remove the users: