Thuta Learning
IntermediateData & Databasesintermediate

Delete Documents

Relax. We'll talk through this in plain words — no textbook voice.

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)