How to delete selected multiple records in a collection in MongoDB using MongoDB compass

anil picture anil · May 21, 2018 · Viewed 15.2k times · Source

I'm very new to MongoDB and MongoDB Compass.

I have some 1000 records in a customer collection. How I can delete all the records at once through MongoDB compass.

Many Thanks,

Answer

Muhammad Tariq picture Muhammad Tariq · Nov 30, 2020

You can use Embedded Shell provided by the MongoDB compass. Its in beta mode right now. I am using compass version 1.23.0

MongoDB compass with Shell

To delete multiple records, you can use db.<collectionname>.deleteMany
https://docs.mongodb.com/manual/reference/method/db.collection.deleteMany/