MongoDB Drop Collection
By Yashwant Chavan, Views 1082, Last updated on 01-Mar-2019
In this tutorial we will learn how to drop mongoDB collection from the database.
mongoDB Drop Collection - db.collection.drop()
mongoDB removes a collection from the database. It also removes all the indexes which is associated with the dropped collection. Refer following drop() method syntax.
It will return true when successfully drops a collection from the database otherwise return false. The following example we will drop the animals collection from the technicalkeeda database.
> use technicalkeeda switched to db technicalkeeda > show collections animals logs persons profiles system.indexes > db.animals.drop(); true
Verify the drop() method output. Use show collections to list of collections into database.
> show collections logs persons profiles system.indexes >
Hi there! I am founder of technicalkeeda.com 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][gmail.com]