MongoDB Drop Database

In MongoDB, we can manually drop a database to delete the associated data files of the current database using dropDatabase command.

  • Type the command use DATABASE_NAME in the command prompt to create a new database or to select the already created database with the respective name.

For Example: use Hellodb

  • Type the command dropDatabase() in the command prompt to delete the selected database.
  • Type the command show dbs in the command prompt to check the database list.
  • If no database is selected the dropDatabase() command will delete the default “test” database.