technotes · topic

MongoDB

First-principles depth, taught by contrast with Postgres/InnoDB — the document model, WiredTiger storage, indexing, the aggregation pipeline, replica sets & sharding.

GlossaryContext: MongoDB current (7.0/8.0+)Core arc complete · 10 lessons

Lessons

  1. 0001 The document model

    The document is the unit of storage, atomicity, and schema design — so embedding, single-document atomicity, and "design for your access pattern" all derive from one keystone fact.

    done
  2. 0002 WiredTiger: how documents are stored

    The storage engine up close — a B-tree, document-level concurrency, MVCC snapshots, the journal and checkpoints, and automatic space reuse (no VACUUM). The surprise: closer to InnoDB than to the Postgres heap.

    done
  3. 0003 Indexing & the ESR rule

    B-tree indexes and the leftmost-prefix rule you know from SQL, plus the two Mongo-specific parts: ordering a compound index by Equality-Sort-Range, and indexing arrays (multikey).

    done
  4. 0004 The query planner & explain()

    COLLSCAN vs IXSCAN, the examined-vs-returned tell, and the twist: Mongo races candidate plans and caches the winner by shape instead of costing them from statistics.

    done
  5. 0005 The aggregation pipeline

    Stages as a data pipeline — $match, $group, $sort, and $lookup (the join the document model avoids), plus why $match-first is predicate pushdown.

    done
  6. 0006 Schema design: embed vs reference

    The decision framework — one-to-few / one-to-many / one-to-squillions — and the anti-patterns (unbounded arrays, massive documents). Closes the loop from $lookup back to 0001.

    done
  7. 0007 Replica sets

    One primary, N secondaries, one oplog. The oplog is logical and idempotent — your MySQL binlog/Postgres WAL contrast, but built into the topology primitive. Automatic elections, failover window, read preference.

    done
  8. 0008 Write concern & read concern

    Two orthogonal dials: w (replication acknowledgment) and j (journal flush). Their combinations set your durability/latency position — from fire-and-forget to majority + journaled. Read concern to match.

    done
  9. 0009 Sharding

    Horizontal scale: mongos router, config servers, shards (each a replica set). Shard key properties — cardinality, write distribution, query isolation. Targeted query vs scatter-gather. Range vs hash sharding. Anti-patterns.

    done
  10. 0010 Multi-document transactions & synthesis

    The escape hatch from single-document atomicity — snapshot isolation, write conflicts, the performance cost, and why schema design usually removes the need. Cross-arc synthesis quiz spanning all ten lessons.

    done

Reference

These lessons have a teacher attached, and this course leans on your Postgres/InnoDB knowledge on purpose. Bring a real schema-design dilemma, an explain(), or a Mongo-vs-relational contrast that feels off, and we'll dissect it together.