MongoDB Drop Database

By Yashwant Chavan, Views 1188, Last updated on 02-Mar-2019

In this tutorial we will learn how to drop database using mongoDB shell command.

tags mongodb

mongoDB drop database - db.dropDatabase()

db.dropDatabase() - removes the current database, also it deletes all the data files which is associated to database. Refer following dropDatabase() method syntax.


To demonstrate dropDatabase() method, Let's display the existing databases using show dbs command.

> show dbs
admin           0.078GB
local           0.078GB
technicalkeeda  0.078GB
test            0.203GB
yourdb          0.203GB

use operation is used to switch the current database to the technicalkeeda database and then uses the db.dropDatabase() method to drops the technicalkeeda database.

> use technicalkeeda
switched to db technicalkeeda
> db.dropDatabase()
{ "dropped" : "technicalkeeda", "ok" : 1 }

Verify the change.

> show dbs
admin   0.078GB
local   0.078GB
test    0.203GB
yourdb  0.203GB


Hi there! I am founder of and programming enthusiast. My skills includes Java,J2EE, Spring Framework, Nodejs, PHP and lot more. If you have any idea that you would want me to develop? Lets connect: yashwantchavan[at][]