I'm using MongoDB
for a while with my projects. But Um currently New to MongoDB
compass application. so When I want to delete a lot of documents at a time .
How will I perform that operation in Mongo Compass
?
While searching for shell option with MongoDB Compass, I come to know that compass also provides built-in shell which can be used to execute MongoDB commands. Please check my answer below for more information.
How to delete selected multiple records in a collection in MongoDB using MongoDB compass
Cheers,
A workaround in Compass, drop the collection first and then create the collection with the same name, or even import some sample document.
The only way [until release 1.20.5], is to execute the delete command from mongo-shell.
Here are the steps and example to delete multiple documents matching a filter, using a mongo-shell
mongo "mongodb+srv://cluster-name.mongodb.net/db_name" --username <uasername> --password <password>
db.users.remove( { status : "P" } )
to remove all documents from the users collection where the status field equals "P"Latest stable version of Compass (1.16.3) does not support a delete many operation. To do that, you need to use the mongo shell - https://docs.mongodb.com/v3.2/tutorial/remove-documents/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With