MongoDB Labs Overview
This page maps each hands-on lab to the theory topic it reinforces.
All labs are MongoDB shell scripts (mongosh) located in the labs/ directory.
Running Labs
# Start the cluster first
cd docker && docker compose up -d
# Run a specific lab
docker exec -it mongo1 mongosh --file /labs/01_database_basics.js
# Interactive shell
docker exec -it mongo1 mongosh
Lab Summary
| Lab | File | Description | Theory Module |
|---|---|---|---|
| 01 | 01_database_basics.js |
CRUD operations, projections, bulk writes | NoSQL & MongoDB, Core Concepts |
| 02 | 02_document_modeling.js |
Embedding vs referencing, 1-to-many, many-to-many | Data Modeling |
| 03 | 03_indexes.js |
Single-field, compound, multikey, text, partial, sparse; explain() | Indexes & Aggregation |
| 04 | 04_aggregation_pipeline.js |
$match, $group, $project, $unwind, $sort, $count | Indexes & Aggregation |
| 05 | 05_transactions.js |
Multi-document ACID transactions, retry logic | Transactions & Consistency |
| 06 | 06_ttl_and_capped.js |
TTL indexes, capped collections, change stream intro | TTL & Change Streams |
| 07 | 07_advanced_aggregation.js |
$lookup, $facet, $bucket, $graphLookup, $setWindowFields | Advanced Aggregation |
| 08 | 08_schema_patterns.js |
Bucket, Computed, Polymorphic, Outlier, Subset patterns | Data Modeling |
| 09 | 09_replica_set.js |
rs.status(), read preferences, writeConcern, replication lag | Core Concepts, Advanced Topics |
| 10 | 10_security_basics.js |
createUser, built-in roles, custom roles, TLS guidance | Advanced Topics |
| 11 | 11_monitoring_and_performance.js |
explain(), profiler, $indexStats, serverStatus, currentOp | Advanced Topics |
Lab Progression
Lab 01: CRUD Basics
└── Lab 02: Document Modeling (how to structure data)
└── Lab 03: Indexes (speed up queries)
└── Lab 04: Aggregation Pipeline (transform + analyze)
└── Lab 05: Transactions (atomic multi-doc writes)
└── Lab 06: TTL & Capped (lifecycle management)
└── Lab 07: Advanced Aggregation ($lookup, $facet)
└── Lab 08: Schema Patterns (real-world designs)
└── Lab 09: Replica Set (HA + consistency)
└── Lab 10: Security (auth + roles)
└── Lab 11: Monitoring (performance)
For detailed explanations, see the linked theory modules.