How to Delete MongoDB Documents by Importing a File

As of mongoimport version 100.0.0, you can delete documents in MongoDB based on an imported file. To do this, use delete mode.

When you use delete mode, if an imported document has the same _id value as an existing one in the collection that you’re importing into, the existing document will be deleted.

You can also specify another field or fields (other than the _id field) to be the matching field if required.

Continue reading