0 votes
in MongoDB by
How do we delete everything from the MongoDB database?

1 Answer

0 votes
by
By using the following code, we can delete everything from the MongoDB database:

use [database];

db.dropDatabase();

Ruby code should be pretty similiar.

Also, from the command line:

mongo [Database] -eval "db.dropDatabase();"

use

[databaseName]

db.Drop+databasename();

drop colllection

use databaseName

db.collectionName.drop();
...