How do you Delete a Document?

The MongoDB shell provides the following methods to delete documents from a collection:

  • To delete multiple documents, use db.collection.deleteMany()

  • To delete a single document, use db.collection.deleteOne()

Sources:

Delete Documents — MongoDB Shell. mongodb.com/docs/mongodb-shell/crud/delete.