deleteOne()
Reference group: Collection CRUD methods
What it does
Deletes at most one matching document.
Syntax
db.collection.deleteOne(filter)
Use case
Remove one known record.
deleteOne(): practical example
db.sessions.deleteOne({ _id: sessionId })💡 Explanation
Deletes at most one matching document.
When to use it
Remove one known record.
Key Takeaways
- Deletes at most one matching document.
- Typical use: Remove one known record.