MongoDB Drop collection

In MongoDB, we can manually drop a collection to completely delete a collection from a database using db.collection_name.drop() method.

  • 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 show collections in the command prompt to check the created collections.
  • Type the command collection_name.drop() in the command prompt to delete the selected collection.

For Example: db.HELLO.drop()

  • Type the command show collections in the command prompt to check the remaining collections.