Quiz Entry - updated: 2026.06.20
How do you delete documents from MongoDB?
Call deleteMany() with a query object to remove every matching document from the collection.
await birthdays.deleteMany({
name: { $eq: 'Anna' }
});
- Query syntax is the same as
find deleteManyremoves ALL matching documents- Use
deleteOneto remove only the first match - Pass empty object
{}to delete all documents (use with caution!)