MongoDB Delete Database

MongoDB Delete Database

 MongoDB Delete Database


The dropDatabase() command is used to delete the current database calculating all the associated data files. To remove any database first you need to select that database. You can use show dbs command to list available databases.

> use mydb

Now run the drop database command to delete the currently selected database. Before deleting any database, make sure to take backup Mongodb database.

> db.dropDatabase()

{ "dropped" : "mydb", "ok" : 1 }
Reactions

Post a Comment

0 Comments

close