MongoDB Drop Database - MongoDB

How to drop a database in MondoDB?

In this chapter, we will explain how to drop a database using MongoDB command.

dropDatabase() Method

MongoDB db.dropDatabase() command is used for dropping an existing database.


Basic syntax of dropDatabase() command is as follows

This deletes the selected database. If no database is selected, then it will delete default 'test' database.


First, check the list of available databases by using the command, show dbs.

To delete the new database <mydb>, then dropDatabase() command would be as follows

Now check list of databases.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

MongoDB Topics