MongoDB is an open-source, document-oriented NoSQL database that stores data in flexible, JSON-like BSON documents. Known for horizontal scalability, rich querying, and a powerful aggregation framework, MongoDB is used by organizations ranging from startups to Fortune 500 companies. The current stable release is MongoDB 8.0 (GA October 2024), which introduces a new bulkWrite command across multiple collections, updateOne with sort, Queryable Encryption range queries, automatic compaction, per-CPU TCMalloc caches, and significant performance improvements. MongoDB Atlas, the fully managed cloud service, continues to expand with Atlas Vector Search, Atlas Stream Processing, and Atlas Search. This cheat sheet covers the complete MongoDB ecosystem from basic CRUD operations and query operators through advanced aggregation, indexing strategies, replication, sharding, security, and Atlas-specific features.
What This Cheat Sheet Covers
This topic spans 51 focused tables and 412 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: BSON Data Types
| BSON Type | Example | Description |
|---|---|---|
{ price: 19.99 } | β’ 64-bit IEEE 754 floating point number β’ default numeric type in the shell | |
{ name: "MongoDB" } | UTF-8 encoded character string | |
{ addr: { city: "NYC" } } | Embedded/nested BSON document | |
{ tags: ["db", "nosql"] } | Ordered list of values of any BSON type | |
BinData(0, "data") | β’ Arbitrary byte string β’ used for files, encrypted fields, UUIDs | |
ObjectId("507f1f77bcf86cd799439011") | β’ 12-byte unique identifier β’ default _id typeβ’ contains timestamp | |
{ active: true } | true or false value | |
{ created: ISODate("2026-04-21") } | 64-bit integer representing milliseconds since Unix epoch |