mongodb/mongo
Lore
A timeline of how MongoDB's source repository evolved. Dates come from git history (commits, tags, and file creation timestamps) and the in-tree docs.
Eras
The pre-launch monolith (Oct 2007 – early 2009)
The repository's first commit is e73188b5512 on 2007-10-19, titled "first commit". The next two days bring "made compile in linux" and "use constant" — the project was bootstrapped on a single developer's laptop and only later made portable. Through 2008 the codebase grew from a single-process database into a replicated one, with a custom storage layer and the BSON format taking the shape it still has today.
Replica sets and sharding (2010 – 2013)
By the time MongoDB 1.6 shipped in Aug 2010, replica sets had replaced the older "master/slave" pattern and the sharding router (mongos) had become a first-class binary. Most of src/mongo/db/repl/ and src/mongo/s/ traces back to this era, even though every file has been heavily rewritten since. The code that performs replica-set elections (now in src/mongo/db/repl/) survives as one of the longest-evolving subsystems in the project.
MMAPv1 → WiredTiger (2014 – 2016)
MongoDB's original storage engine, MMAPv1, was an mmap-based heap that didn't support document-level locking. The 3.0 release in Mar 2015 introduced a pluggable storage engine API and shipped WiredTiger as an option; 3.2 (Dec 2015) made WiredTiger the default; later releases dropped MMAPv1 entirely. The wrapper for WiredTiger now lives at src/mongo/db/storage/wiredtiger/ and the bundled engine at src/third_party/wiredtiger/. The src/mongo/db/storage/ interface — RecordStore, SortedDataInterface, RecoveryUnit, StorageEngine — is a direct artifact of that refactor.
The aggregation, query, and SBE rewrites (2016 – 2022)
The aggregation pipeline (src/mongo/db/pipeline/) grew from a small set of stages into the primary query language for MongoDB. In parallel, the query system grew the classic execution engine under src/mongo/db/exec/classic/ and, later, the Slot-Based Execution (SBE) engine under src/mongo/db/exec/sbe/. SBE was introduced in MongoDB 5.0 (Jul 2021) as an opt-in fast path; 7.0 (2023) and 8.0 (2024) progressively expanded the set of plans SBE handles. Both engines coexist in the tree today.
Multi-document transactions, retryable writes, and change streams (2017 – 2019)
MongoDB 3.6 (Dec 2017) introduced change streams (docs/change_streams.md, ~44 KB of design docs, plus src/mongo/db/pipeline/document_source_change_stream*). 4.0 (Jun 2018) added single-shard ACID transactions; 4.2 (Aug 2019) extended them to sharded clusters via the TransactionRouter on mongos (still the largest single source file in src/mongo/s/). The associated wire protocol expansion — OP_MSG, retryable writes, and the OperationSession model — lives in src/mongo/rpc/, src/mongo/db/session/, and src/mongo/db/transaction/.
Time-series, queryable encryption, and resharding (2021 – 2023)
5.0 (Jul 2021) shipped time-series collections (src/mongo/db/timeseries/) and online resharding (src/mongo/db/s/resharding/, src/mongo/s/resharding/). 6.0 (Jul 2022) added Queryable Encryption (src/mongo/crypto/, src/mongo/db/query/fle/). The latter brought a substantial new IDL surface and a new family of pipeline stages. Resharding is one of the most complex distributed protocols in the codebase; the db/global_catalog/ddl/ directory is dominated by the long-running coordinators it spawned.
Bazel migration (2023 – 2024)
The build system migrated from SCons to Bazel over roughly a year. The former SConstruct is gone; every directory now carries a BUILD.bazel, the toolchain rules live under bazel/, and MODULE.bazel (and its 125 KB lockfile MODULE.bazel.lock) pin every external dependency. This is the largest mechanical change to the repository in its history — almost every directory was touched.
The modules effort and modern API hygiene (2024 – present)
A long-running effort — documented in docs/modularity.md and the modules_poc/ tree — assigns every file to a named module and marks the visibility of every API (PUBLIC, PRIVATE, FILE_PRIVATE, NEEDS_REPLACEMENT, etc.). The tooling (modules_poc/merge_decls.py, modules_poc/private_headers.py, modules_poc/browse.py) is built on top of the existing Bazel build and uses Clang's AST to find cross-module API usages. This is the most ambitious code-hygiene initiative in MongoDB's history and is still in progress as of Apr 2026.
The repository also recently picked up:
- gRPC transport (
src/mongo/transport/grpc/) alongside the long-standing ASIO-based transport. - An OpenTelemetry export path (
src/mongo/otel/). - The
shard_role/router_rolesplit that lets a single binary act as both a shard and a router (Apr 2025).
Longest-standing features
| Feature | First introduced | Notes |
|---|---|---|
| BSON | 2007 (src/mongo/bson/) |
The serialization format. Has been refactored heavily — current implementation in src/mongo/bson/. |
The Command framework |
~2008 (src/mongo/db/commands/) |
Every wire-protocol command is still a Command subclass registered via MONGO_REGISTER_COMMAND. |
| Replica sets | 2010 | The election protocol was rewritten as PV1 around 3.2 but the surrounding scaffolding has been continuous. |
| The aggregation pipeline | 2.2 (Aug 2012) | The pipeline stages ($match, $group, $lookup, etc.) live under src/mongo/db/pipeline/ and grow each release. |
mongos |
1.6 (Aug 2010) | The router has been continuously enhanced; transactions and resharding made it dramatically more complex. |
| The shell | 2007 (originally a custom JavaScript shell) | Now jstestshell for in-tree use; the user-facing mongosh is a separate, NodeJS-based project. |
Deprecated or removed features
| Feature | Removed |
|---|---|
| MMAPv1 storage engine | Removed in 4.2 (Aug 2019) after WiredTiger had been the default for ~3 years. |
| Master/slave replication | Removed in 4.0. Replaced by replica sets. |
OP_QUERY/OP_GET_MORE/OP_KILL_CURSORS |
Wire-protocol opcodes deprecated in favor of OP_MSG (3.6) and removed for new operations in 5.1. |
| The "mongo" shell | Renamed to jstestshell (the in-tree test shell). External users moved to the standalone mongosh project. |
| SCons build | Replaced by Bazel in the 2023–2024 timeframe. The remaining SConstruct was removed when the migration completed. |
In-tree mongo MongoDB shell helpers |
Many shell helper files (src/mongo/shell/) were trimmed once the user-facing shell moved out of the repository. |
Major rewrites
- Storage engine API (3.0) — pluggable storage and the
RecordStore/SortedDataInterfaceabstractions. - Replication PV1 (3.2) — a Raft-inspired election protocol replacing the legacy implementation.
- Wire protocol unification (3.6) —
OP_MSGreplacing the older opcode zoo. - SBE introduction (5.0) — a second query execution engine living next to the classic one.
- Sharded transactions (4.2) — the
TransactionRouterand the cooperative two-phase commit across shards. - Build system (2023–2024) — Bazel replacing SCons.
- Logging (logv2, 4.4) — structured JSON logging replacing the old printf-style log.
Growth trajectory
The repository's commit cadence has trended steadily upward. The last twelve months alone (May 2025 – Apr 2026) show ~10,100 commits, with the highest monthly tally — 1,209 commits in March 2026 — corresponding to the run-up to a major release. The number of unique human committers per year is in the low hundreds (236 in the last 365 days).
The shape of the source tree has also evolved. New top-level directories under src/mongo/db/ over the last few years include shard_role/, router_role/, global_catalog/, sharding_environment/, versioning_protocol/, and extension/, reflecting the gradual factoring of cross-cutting concerns out of the historical "everything in src/mongo/db/" layout.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.