MongoDB Cheat Sheet
|
This section documents the current MongoDB 8.x server line as published at the MongoDB Server Manual, which is the reference these pages are written and verified against. No specific patch version is pinned. Some capabilities (Atlas Search, Atlas Vector Search, and parts of encryption and backup) are Atlas-only — they are linked, not documented in depth. This content was generated with the assistance of AI and should be verified against the official manual before being relied on in production, since MongoDB iterates quickly. This section’s bibliography lists the reference material consulted while preparing these pages. |
A single-page, colour-coded summary of the MongoDB essentials — the mongod / mongosh and connection-string
one-liners, the BSON document model and _id / ObjectId, the write API (insertOne / insertMany /
bulkWrite) and write concern, find filters, projection and the query operators, the cursor methods, the
update and array operators with the positional forms and upserts, index creation and types with the Equality — Sort — Range rule and explain(), the aggregation stage list and accumulators, a withTransaction skeleton,
the replica-set and sharding commands with the read-preference and read/write-concern values, the backup and
data-movement tools, and an "embed vs. reference" decision strip — handy for quick memorization or as a
printable desk reference.
For the full explanation, every option, and additional examples, see the dedicated pages:
Getting started — Getting Started.
Data & schema — Documents, BSON & Data Types and Databases, Collections & Schema Control.
CRUD / Query API — Inserting Data, Bulk Writes & Write Concern, Reading Data with the Query API, and Updating & Deleting Documents.
Indexing & search — Indexing & Query Performance and Text, Wildcard, Geospatial & Atlas Search.
Aggregation — The Aggregation Framework.
Schema design — Schema Design for the Document Model.
Transactions & change streams — Multi-document ACID Transactions and Reacting to Data Changes.
Replication & sharding — Replica Sets & High Availability and Horizontal Scaling with Sharded Clusters.
Storage, security & operations — WiredTiger, Journaling & Durability, Authentication, Authorization & Encryption, Running & Observing a Deployment, and Backups, Import/Export & GridFS.
Drivers & tooling — Connecting from an Application & the Tooling.
Everything here is verified against the MongoDB Server Manual.