Suggest an editImprove this articleRefine the answer for “How do you delete a document in the DB?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)To delete a document in MongoDB, use `deleteOne()` and `deleteMany()`: the first argument to both is a filter that selects which documents to remove, `deleteOne()` removes just the first matching document, and `deleteMany()` removes every document that matches the condition. **Key point:** to delete one specific record, it's enough to pass a filter with a unique condition (e.g. by `_id` or name).Shown above the full answer for quick recall.Answer (EN)ImageTo delete a document in MongoDB, use `deleteOne()` and `deleteMany()`. ### Deleting one document: ```js db.users.deleteOne({ name: "Alex" }) ``` MongoDB finds the first document matching the filter and deletes it. ### Deleting several documents: ```js db.users.deleteMany({ isActive: false }) ``` Every document matching the condition gets deleted. ### A note on the logic: - the first argument is a **filter** that selects which documents to delete, - `deleteOne()` deletes only one document, - `deleteMany()` deletes every document that matches. So, to delete data in MongoDB, it's enough to apply one of these two methods with the right filter.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.