Skip to content
Pressentify
Home
Learn
Handbooks
32 print-ready volumes across 6 handbooks
7 volumes
System Design
2 volumes
AWS Production
4 volumes
Python
6 volumes
FastAPI
7 volumes
AI Full-Stack
6 volumes
Django
Topics
14 courses, beginner to production
Python
PostgreSQL
System Design
Django
MongoDB
AWS
AI Full-Stack
Data Structures & Algorithms
JavaScript
React
Docker
FastAPI
Next.js
MySQL
Cheatsheets
8 one-page quick references
Python
PostgreSQL
System Design
Django
MongoDB
AWS
AI Full-Stack
Data Structures & Algorithms
DSA Lab
12 animated lessons, synced to running code
Binary Search
Two Pointers
Maximum Subarray (Kadane’s)
Move Zeroes
Minimum Size Subarray Sum
Roadmap
Study planner
Job hunt
AI Interview
Blog
Sign in
Get started
Cheatsheets
/
MongoDB
MongoDB cheat sheets
26 sheets · 26 sections
Quick reference
Full course
01
MongoDB Fundamentals
1 sheet
MongoDB Fundamentals
Document-oriented databases
Databases, collections, documents and fields
Document model vs. relational model
Naming conventions and flexible schemas
CRUD, conceptually
The MongoDB shell (mongosh)
Schema-flexible, not schema-free
02
BSON and Data Types
1 sheet
BSON and Data Types
BSON types
BSON vs. JSON
BSON size and serialization
Integer types and numeric precision
Decimal128
BSON Date
ObjectId structure
03
Documents and Collections
1 sheet
Documents and Collections
Embedded documents vs. references
Nested fields and dot notation
Arrays of scalars vs. arrays of documents
Document shape and performance
Collection-level concerns
Collections as business concepts
04
CRUD Operations
1 sheet
CRUD Operations
The CRUD method surface
Upserts
Field update operators
Array update operators
Positional update patterns
Projection and field selection
sort, skip, limit — and why skip gets expensive
bulkWrite() — ordered vs. unordered
05
Query Language
1 sheet
Query Language
Equality, range and array queries
Comparison operators
Logical operators: $and, $or, $nor, $not
Element operators: $exists, $type
Array operators: $all, $elemMatch, $size
Evaluation operators and regular expressions
Dot notation for nested fields
How compound query predicates interact with compound indexes
06
Data Modeling
1 sheet
Data Modeling
Schema design as workload-driven design
Start from access patterns, not only entities
Workload types to identify
Deciding what to embed and what to reference
Embedding trade-offs
Referencing trade-offs
Bounded vs. unbounded arrays
Document growth and the risks of unbounded embedding
Co-locating frequently accessed related data
07
Embedding vs. Referencing
1 sheet
Embedding vs. Referencing
Embed-when and reference-when signals
Modeling strategies by relationship cardinality
The named schema design patterns, as a set
Denormalization as an intentional choice, not a shortcut
Schema design as a performance decision
08
Schema Design Patterns
1 sheet
Schema Design Patterns
The six patterns, worked in detail
How bucket boundaries affect update and query cost
Modeling event and history data without giant documents
Precomputing counters and summaries
09
Schema Validation
1 sheet
Schema Validation
Collection validators
JSON Schema validation concepts
Using validation for structural and type guarantees
validationLevel and validationAction
Balancing flexible evolution with strong validation
Application validation is not the only protection
10
Indexing Fundamentals
1 sheet
Indexing Fundamentals
Why indexes exist
Single-field indexes
Compound indexes
Multikey indexes
Unique indexes
Sparse and partial indexes
TTL indexes
Text indexes and their trade-offs
Key ordering: equality, sort, and range
11
Compound Index Design
1 sheet
Compound Index Design
ESR: equality, sort, range
Designing indexes from real query patterns
Index field order changes what the index can do
Compound index prefix behavior
Indexes trade write and storage cost for read speed
How too many indexes hurt writes and memory
Separate indexes vs. one compound index
12
Multikey and Array Indexes
1 sheet
Multikey and Array Indexes
When an index becomes multikey
Hashed-index and sort limitations on multikey fields
The compound multikey restriction
How array cardinality affects index size
Designing arrays with bounded growth, for indexing
13
Partial, Sparse, Unique, and TTL Indexes
1 sheet
Partial, Sparse, Unique, and TTL Indexes
partialFilterExpression: what it accepts, and sizing the reduction
What "missing" means for a sparse index
Unique indexes and missing fields, plus the sparse+unique fix
TTL deletion is asynchronous, not exact-time
14
Query Planning
1 sheet
Query Planning
What the query planner does
COLLSCAN vs. IXSCAN
FETCH, SORT, and other execution stages
How a winning plan is selected among candidates
Using explain() to investigate a query
Reading rejected plans in practice
Using an index does not guarantee a fast query
15
explain() and Performance Analysis
1 sheet
explain() and Performance Analysis
Choosing the right explain() verbosity
Reading executionStats: the key numbers
Recognizing the "examine many, return few" pattern
Comparing plans before and after an index change
The database profiler, for production-scale diagnosis
16
Aggregation Framework
1 sheet
Aggregation Framework
Aggregation as a pipeline of stages
The core pipeline stages
Pipeline ordering principles
Pushing $match as early as practical
Pipeline memory and intermediate-result limits
Aggregation vs. application-side loops
17
Aggregation Expressions
1 sheet
Aggregation Expressions
Aggregation expression categories
$cond, $ifNull, $switch
$map, $filter, $reduce
Date expressions for grouping
Type conversion expressions
Expression cost and CPU pressure
18
$unwind and Array Processing
1 sheet
$unwind and Array Processing
$unwind explodes arrays into documents
preserveNullAndEmptyArrays and includeArrayIndex
The document-explosion trade-off
$filter/$map instead of full $unwind
19
$lookup and Join-Like Operations
1 sheet
$lookup and Join-Like Operations
$lookup for collection joins
Equality joins vs. pipeline $lookup
$lookup performance implications
$lookup vs. denormalized design
Join field cardinality
20
Window Functions and Advanced Analytics
1 sheet
Window Functions and Advanced Analytics
$setWindowFields fundamentals
Window operators: rank, running total, moving average
Aggregation vs. a dedicated analytics system
21
Transactions
1 sheet
Transactions
Single-document atomicity
Multi-document transactions
Session usage and transaction lifecycle
startTransaction, commitTransaction, withTransaction
Transaction boundaries and cost
Read/write concern in transactions
Transaction retries and transient errors
When a transaction is genuinely the right tool
22
Atomicity and Concurrency
1 sheet
Atomicity and Concurrency
Single-document writes are atomic
Atomic operators instead of read-modify-write
Optimistic concurrency
Version fields and compare-and-set
Race conditions from stale reads
Unique indexes and atomic invariants
23
Read Concern and Write Concern
1 sheet
Read Concern and Write Concern
Write concern: acknowledgement and durability
w, j, and wtimeout
readConcern levels
Choosing concern strength
Consistency is a trade-off, not a free feature
24
Sessions
1 sheet
Sessions
Logical sessions
Why transactions and retryable writes need a session
Session lifetime and driver management
25
Replication
1 sheet
Replication
Replica sets
Primary and secondary members
Replication via the oplog
Elections and failover
What read preference controls
The five read preference modes
Replica lag
Why secondary reads can be stale
26
Replica Set Architecture
1 sheet
Replica Set Architecture
Majority, the unifying concept
Voting members and election implications
Failure scenarios: primary loss and partitions
How concern settings interact with topology
Hidden, delayed, priority, and non-voting members
01
MongoDB Fundamentals
1 sheet
MongoDB Fundamentals
Document-oriented databases
Databases, collections, documents and fields
Document model vs. relational model
Naming conventions and flexible schemas
CRUD, conceptually
The MongoDB shell (mongosh)
Schema-flexible, not schema-free
05
Query Language
1 sheet
Query Language
Equality, range and array queries
Comparison operators
Logical operators: $and, $or, $nor, $not
Element operators: $exists, $type
Array operators: $all, $elemMatch, $size
Evaluation operators and regular expressions
Dot notation for nested fields
How compound query predicates interact with compound indexes
08
Schema Design Patterns
1 sheet
Schema Design Patterns
The six patterns, worked in detail
How bucket boundaries affect update and query cost
Modeling event and history data without giant documents
Precomputing counters and summaries
10
Indexing Fundamentals
1 sheet
Indexing Fundamentals
Why indexes exist
Single-field indexes
Compound indexes
Multikey indexes
Unique indexes
Sparse and partial indexes
TTL indexes
Text indexes and their trade-offs
Key ordering: equality, sort, and range
15
explain() and Performance Analysis
1 sheet
explain() and Performance Analysis
Choosing the right explain() verbosity
Reading executionStats: the key numbers
Recognizing the "examine many, return few" pattern
Comparing plans before and after an index change
The database profiler, for production-scale diagnosis
17
Aggregation Expressions
1 sheet
Aggregation Expressions
Aggregation expression categories
$cond, $ifNull, $switch
$map, $filter, $reduce
Date expressions for grouping
Type conversion expressions
Expression cost and CPU pressure
21
Transactions
1 sheet
Transactions
Single-document atomicity
Multi-document transactions
Session usage and transaction lifecycle
startTransaction, commitTransaction, withTransaction
Transaction boundaries and cost
Read/write concern in transactions
Transaction retries and transient errors
When a transaction is genuinely the right tool
24
Sessions
1 sheet
Sessions
Logical sessions
Why transactions and retryable writes need a session
Session lifetime and driver management
02
BSON and Data Types
1 sheet
BSON and Data Types
BSON types
BSON vs. JSON
BSON size and serialization
Integer types and numeric precision
Decimal128
BSON Date
ObjectId structure
06
Data Modeling
1 sheet
Data Modeling
Schema design as workload-driven design
Start from access patterns, not only entities
Workload types to identify
Deciding what to embed and what to reference
Embedding trade-offs
Referencing trade-offs
Bounded vs. unbounded arrays
Document growth and the risks of unbounded embedding
Co-locating frequently accessed related data
09
Schema Validation
1 sheet
Schema Validation
Collection validators
JSON Schema validation concepts
Using validation for structural and type guarantees
validationLevel and validationAction
Balancing flexible evolution with strong validation
Application validation is not the only protection
12
Multikey and Array Indexes
1 sheet
Multikey and Array Indexes
When an index becomes multikey
Hashed-index and sort limitations on multikey fields
The compound multikey restriction
How array cardinality affects index size
Designing arrays with bounded growth, for indexing
14
Query Planning
1 sheet
Query Planning
What the query planner does
COLLSCAN vs. IXSCAN
FETCH, SORT, and other execution stages
How a winning plan is selected among candidates
Using explain() to investigate a query
Reading rejected plans in practice
Using an index does not guarantee a fast query
18
$unwind and Array Processing
1 sheet
$unwind and Array Processing
$unwind explodes arrays into documents
preserveNullAndEmptyArrays and includeArrayIndex
The document-explosion trade-off
$filter/$map instead of full $unwind
20
Window Functions and Advanced Analytics
1 sheet
Window Functions and Advanced Analytics
$setWindowFields fundamentals
Window operators: rank, running total, moving average
Aggregation vs. a dedicated analytics system
22
Atomicity and Concurrency
1 sheet
Atomicity and Concurrency
Single-document writes are atomic
Atomic operators instead of read-modify-write
Optimistic concurrency
Version fields and compare-and-set
Race conditions from stale reads
Unique indexes and atomic invariants
26
Replica Set Architecture
1 sheet
Replica Set Architecture
Majority, the unifying concept
Voting members and election implications
Failure scenarios: primary loss and partitions
How concern settings interact with topology
Hidden, delayed, priority, and non-voting members
03
Documents and Collections
1 sheet
Documents and Collections
Embedded documents vs. references
Nested fields and dot notation
Arrays of scalars vs. arrays of documents
Document shape and performance
Collection-level concerns
Collections as business concepts
04
CRUD Operations
1 sheet
CRUD Operations
The CRUD method surface
Upserts
Field update operators
Array update operators
Positional update patterns
Projection and field selection
sort, skip, limit — and why skip gets expensive
bulkWrite() — ordered vs. unordered
07
Embedding vs. Referencing
1 sheet
Embedding vs. Referencing
Embed-when and reference-when signals
Modeling strategies by relationship cardinality
The named schema design patterns, as a set
Denormalization as an intentional choice, not a shortcut
Schema design as a performance decision
11
Compound Index Design
1 sheet
Compound Index Design
ESR: equality, sort, range
Designing indexes from real query patterns
Index field order changes what the index can do
Compound index prefix behavior
Indexes trade write and storage cost for read speed
How too many indexes hurt writes and memory
Separate indexes vs. one compound index
13
Partial, Sparse, Unique, and TTL Indexes
1 sheet
Partial, Sparse, Unique, and TTL Indexes
partialFilterExpression: what it accepts, and sizing the reduction
What "missing" means for a sparse index
Unique indexes and missing fields, plus the sparse+unique fix
TTL deletion is asynchronous, not exact-time
16
Aggregation Framework
1 sheet
Aggregation Framework
Aggregation as a pipeline of stages
The core pipeline stages
Pipeline ordering principles
Pushing $match as early as practical
Pipeline memory and intermediate-result limits
Aggregation vs. application-side loops
19
$lookup and Join-Like Operations
1 sheet
$lookup and Join-Like Operations
$lookup for collection joins
Equality joins vs. pipeline $lookup
$lookup performance implications
$lookup vs. denormalized design
Join field cardinality
23
Read Concern and Write Concern
1 sheet
Read Concern and Write Concern
Write concern: acknowledgement and durability
w, j, and wtimeout
readConcern levels
Choosing concern strength
Consistency is a trade-off, not a free feature
25
Replication
1 sheet
Replication
Replica sets
Primary and secondary members
Replication via the oplog
Elections and failover
What read preference controls
The five read preference modes
Replica lag
Why secondary reads can be stale