The CRUD method surface
corebeginnerNine methods cover CRUD in practice: insertOne/Many create, find/findOne read, updateOne/Many change fields, replaceOne swaps a whole document, deleteOne/Many remove. Each has a "One" and, where it makes sense, a plural form.
Think of it as
The five conceptual verbs from Fundamentals each become one or two real methods: the "One" variant stops after the first match, the plural variant (or find's cursor) keeps going across every match. Learning the pattern — verb + One/Many/plural — makes the nine methods one idea, not nine separate ones to memorize.
What we're doing: Show why calling updateOne where updateMany was intended silently under-applies a change.
- 2
- updateOne stops after the first match, even though the filter matches three documents.
- 5
- updateMany applies the same update to every matching document.
Why this works: The "One" methods are not shorthand for "the only match" — they stop at the first match regardless of how many documents the filter actually matches, which is easy to miss when testing against data that happens to have only one matching document.
Reaching for updateOne/deleteOne out of habit when every match should be affected
Wrong
Better
What you see: Only one document changes even though the filter clearly matches several — no error is raised.
Why: updateOne/deleteOne succeed silently after touching exactly one match; nothing signals that more documents matched the filter and were left alone.
- Create
- insertOne — one document
- insertMany — many documents
- Read / Update / Delete
- find / findOne — all / first match
- updateOne / updateMany — first / all matches
- deleteOne / deleteMany — first / all matches
The nine CRUD methods
Together
Remember: insertOne/Many, find/findOne, updateOne/Many, replaceOne, deleteOne/Many. "One" stops at the first match — it does not mean "the only match."
See also: crud overview · upserts

