MongoDB Drop collection-Programmershelper



In this article, we learn MongoDB Drop collection. My main focus describes its simple steps. Drop statement<db.collection.drop()> is used to delete the table and also delete it’s all the data as well from a database. You will delete existing collection in the database.


You should also read my previous articles. In which I explained. MongoDB sort a document guideline and MongoDB Drop a database.

Implementation Section

  • db.collection.drop().


The following is a basic syntax-

  • <db> is a reserved word.
  • <Drop> is also a reserved word used for drop collection.
  • <Collection_name> selected collection name which you want to remove.


Drop a collection-:

Practical work:

First, we find the available list of a collection that exists in a database.

First, we will use command name<show collections> and check the existing database.


Alt tag MongoDB drop collection

Now we remove collection name like <programmerhelper>.the following query is used to drop a database-


Drop method will return true if it deleted the selected collection.otherwise its return will see both works below a fig.first time I drop <programmershelper> collection its return <true> result. Second time again repeat that work and result give <false>.

Alt tag MongoDB Drop collection

Now check again a list of collection.the following command is used-


Alt Tag MongoDB drop collection


I wish I could tell you that a great site of MongoDB. You just understands the key element above post-MongoDB Drop collection. You also read my previous lecture. I hope you will understand this lecture. Thank you for reading this lecture. Hope you got the idea. please share it.