MongoDB
Document storage with a flexible schema.
MongoDB is taught here in 14 lessons, running from Documents, collections and queries through to Next steps: Atlas Search, time series and vector search. Each lesson takes one topic, shows the working code, and links onward to the next, so the course can be read straight through in order.
| Track | Databases |
| Lessons | 14 |
| Level | Beginner to intermediate |
| Reading time | about 3 hours |
| Prerequisites | Helpful, but not required: PostgreSQL |
Lessons
- Documents, collections and queriesThe document model, dot notation into nested data, and the query and update operators you will use every day.
- The aggregation pipelineStages as a sequence of transformations, the accumulators worth knowing, and how to keep a pipeline eligible for indexes.
- Indexes and schema design patternsCompound index ordering with ESR, the index types MongoDB offers, and the patterns that keep documents bounded as data grows.
- Setting up MongoDB: Atlas, local install and mongoshChoose between a local server, a container and Atlas, connect with mongosh, and get data in and out with CRUD, bulk writes and the import tools.
- Data modelling: embedding vs referencing and schema validationDecide when a child belongs inside the parent document, enforce the shape you settled on with JSON Schema, and evolve that shape without a stop-the-world migration.
- Transactions, sessions and read/write concernsUse sessions for causal consistency, wrap multi-document changes in a transaction correctly, and choose read and write concerns that match what the business can tolerate losing.
- Drivers and ODMs in application codeWire the official driver correctly with a single client per process, know what an ODM adds and hides, and handle the errors that actually occur in production.
- Security: authentication, roles and encryptionTurn on authentication before anything else, grant the narrowest role that works, encrypt the wire and the sensitive fields, and know what each layer does not protect.
- Change streams, TTL indexes and triggersReact to writes as they happen with resumable change streams, let the server expire old data with TTL indexes, and build handlers that survive a replay.
- Performance tuning with explain() and the profilerRead a query plan instead of guessing, find the slow operations with the profiler, and know which changes actually reduce the time a query takes.
- Replica sets, failover and read preferencesRun a set with a real majority, understand what an election costs and what a write concern protects, and route reads to a member that can actually serve the answer.
- Sharding and horizontal scalingUnderstand routers, config servers and chunks, choose a shard key that keeps queries targeted and writes even, and know when sharding is the wrong answer.
- Backup, restore and operational toolingPick a backup method from your recovery target rather than from convenience, restore into a scratch namespace first, and monitor the signals that predict trouble.
- Next steps: Atlas Search, time series and vector searchAdd full-text relevance and vector similarity as pipeline stages, store measurements in time-series collections instead of hand-rolled buckets, and know when another store is the better answer.
More in Databases
SQL MySQL PostgreSQL Redis SQLite
FAQ
How long does the MongoDB course take?
It has 14 lessons, about 3 hours of reading. Expect roughly twice that if you type out and run every example.
Do I need prior experience for MongoDB?
Not strictly. It helps to have read PostgreSQL first, because some lessons build on it, but every lesson explains its own assumptions.
What should I read after MongoDB?
Continue with Redis (3 lessons), the next course in Databases.
Last refreshed 2026-09-18.