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();

Related questions

0 votes
asked Jan 6, 2023 in MongoDB by sharadyadav1986
0 votes
asked Jan 7, 2023 in MongoDB by sharadyadav1986
...