Thuta Learning
MongoDB
IntermediateData & DatabasesIntermediate

Delete Documents

MongoDBLesson 14

To delete documents, use deleteOne() or deleteMany().

javascript
// Delete the first document where item is "mat"
db.inventory.deleteOne( { item: "mat" } )

// Delete all documents where tags include "gel"
db.inventory.deleteMany( { tags: "gel" } )
You should see
(The matching documents will be removed from the collection)

Updated on

Progress is saved only in this browser on this device. It isn't synced to other devices.

Report a problem with this lessonOpens your email app with this lesson's address filled in — nothing is sent until you send it.

Delete Documents | Thuta Learning