Delete Methods

MongoDB provides the following methods to delete documents of acollection:

db.collection.deleteOne()Delete at most a single document that match a specified filtereven though multiple documents may match the specified filter.New in version 3.2.
db.collection.deleteMany()Delete all documents that match a specified filter.New in version 3.2.
db.collection.remove()Delete a single document or all documents that match a specified filter.

Additional Methods

The following methods can also delete documents from a collection:

findOneAndDelete()provides a sort option. The option allows for the deletion of thefirst document sorted by the specified order.

db.collection.findAndModify() provides a sort option.The option allows for the deletion of the first document sorted bythe specified order.

See the individual reference pages for the methods for more informationand examples.