1. Home
  2. MongoDB
  3. MongoDB Tutorial
  4. MongoDB – Drop Database

MongoDB – Drop 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 }
Tags ,
Was this article helpful to you? Yes 6 No 2