how to remove all data from specific MongoDB collections1 min read

Prabhin Prabharkaran Administrator
DevOps Engineer

He is a Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!

follow me

HI all, this document shows you how to remove all data from specific MongoDB collections.
MongoDB is NoSQL database, MongoDB uses JSON-like documents with optional schemas.
Sometimes there will be a requirement to delete all the data of specific MongoDB collection.
Here we will provide the steps for that.

Step 1: log in to mongo shell


Step 2: Now choose your database,

>show dbs

>use scrapper

Step 3: now display your collections under scrapper database,

> show collections


Step 4: Now delete all the data from user collection.



Success, now you deleted all the data from user collection. this will keep the collection in the MongoDB but it will delete all the data under the user collection.

thank You!!!!

© 2020, Techrunnr. All rights reserved.

Questions Answered
Articles Written
Overall Points

Related posts

Leave a Reply