CRUD Operations
Creating
insertOne and insertMany return insertedId/insertedIds plus an array of write errors. insertMany is ordered by default: it stops at the first failing document, so later valid documents are never written. Set ordered: false to keep going and collect all errors. Drivers generate _id client-side (an ObjectId by default) before sending, so a document always has one.
Updating
Updates use modifier operators: $set, $unset, $inc, $push, $addToSet, $pull, $pop, $rename, $min, $max, $currentDate. Passing a plain document with no operators is a replacement. upsert: true inserts when nothing matches. Array filters (arrayFilters: [{"e.score": {$lt: 60}}] with $[e]) target specific array elements. findOneAndUpdate returns the pre-image by default; use returnDocument: "after" for the new version.
Reading and deleting
find returns a cursor; queries match whole documents, embedded documents (exact order and values), or sub-fields via dot notation. Projections are inclusion or exclusion - mixing the two is an error, except for _id. deleteOne/deleteMany take the same filter syntax; an empty filter deletes everything.
Traps
{a: {b: 1}} matches an embedded document exactly, not the path a.b. $set: {"a.b": 1} on a missing path creates the nested structure. $push without $each/$slice grows arrays without bound. bulkWrite mixes insert/update/delete ops in one round trip.
Worked rule
Bulk-loading 10,000 documents where some duplicates are expected: use insertMany(docs, {ordered: false}) and inspect writeErrors; with default ordering one duplicate aborts the rest.