Removing data uses deleteOne() for a single document or deleteMany() for every document matching a filter.
Removes the first document matching the filter — if several documents match, only one is deleted:
db.users.deleteOne({ name: "Vikram Singh" })Removes every document matching the filter:
db.users.deleteMany({ status: "archived" })Passing an empty filter object matches every document, effectively emptying the collection while keeping it (and any indexes on it) intact:
db.users.deleteMany({})drop() deletes the entire collection — not just its documents, but the collection itself and any indexes defined on it. This is a separate, more permanent operation from deleteMany({}):
db.users.drop()Deletes are permanent — check with find() first
None of these operations can be undone from inside MongoDB. Before running deleteMany() or drop() against real data, run the equivalent find() query first to see exactly what would be affected.