Open-Source Wikis

/

MongoDB

/

By the numbers

mongodb/mongo

By the numbers

Data collected on 2026-04-30, against commit f92893881df on master.

Size

The first-party source under src/mongo/ is roughly 450k lines of C++ split across ~5,300 .cpp files and ~3,500 .h files, plus 539 .idl files. The repository also carries 7,372 JavaScript regression tests and a substantial Python build/test toolkit.

xychart-beta horizontal
    title "Source lines (thousands), src/mongo/ + jstests + buildscripts"
    x-axis ["C++ headers (.h)", "C++ sources (.cpp)", "JS tests (jstests)", "Python (buildscripts)", "IDL (.idl)"]
    y-axis "kLOC" 0 --> 140
    bar [131, 127, 121, 139, 59]
Category Files Lines
C++ sources (src/mongo/**.cpp) 5,294 126,917
C++ headers (src/mongo/**.h) 3,471 130,520
C++ unit tests (*_test.cpp) 1,713 999,635
IDL definitions (src/mongo/**.idl) 539 58,561
JavaScript tests (jstests/**.js) 7,372 120,660
Python build scripts (buildscripts/**.py) 570 139,495

Note: the *_test.cpp line count is large because integration-style suites and golden-data tests bundle expected outputs and table-driven cases inline with the test logic.

The largest single BUILD.bazel is src/mongo/db/BUILD.bazel at ~120 KB — a side-effect of the breadth of src/mongo/db/ (40+ subdirectories covering replication, sharding, query, storage, transactions, the op observer, time-series, and the global catalog).

Activity

The repository is in continuous, heavy development: ~98,700 commits on master since the first commit on 2007-10-19, with 10,103 commits in the last 365 days and 3,269 in the last 90 days.

xychart-beta horizontal
    title "Commits per month (last 12)"
    x-axis ["2025-05", "2025-06", "2025-07", "2025-08", "2025-09", "2025-10", "2025-11", "2025-12", "2026-01", "2026-02", "2026-03", "2026-04"]
    y-axis "commits" 0 --> 1300
    bar [626, 655, 809, 760, 731, 853, 651, 749, 1014, 898, 1209, 1113]

The most actively changed top-level areas in src/mongo/ are predictably the largest ones: db/query/, db/exec/, db/repl/, db/s/, db/storage/, and s/. Build files (BUILD.bazel) churn along with the source as files move and modules get split.

Bot-attributed commits

In the last year:

  • 236 distinct human committer email addresses appear on master (after filtering out [bot] accounts).
  • ~3.5% of commits in the last year carry a Co-authored-by trailer with a bot account (e.g. factory-droid[bot], dependabot[bot], github-actions[bot]).

This percentage is a lower bound on AI-assisted work: inline assistants like Copilot do not leave a trace in git history, and the MongoDB team's primary contribution path is via Evergreen patches that often land squashed and re-authored.

Complexity hotspots

A handful of files dominate the binary size and review surface area:

File Lines Notes
src/mongo/s/transaction_router_test.cpp ~13 k Largest test file — exercises the cluster transaction protocol exhaustively.
src/mongo/s/transaction_router.cpp ~3.7 k Cluster transaction state machine on mongos. Drives commit/abort fan-out across shards.
src/mongo/db/op_debug.cpp ~3 k The OpDebug profiler payload. Aggregates per-operation metrics for the slow query log.
src/mongo/db/curop.cpp ~1.9 k The current operation tracker. Manages db.currentOp() and the diagnostic snapshot.
src/mongo/db/commands.cpp ~1.8 k The Command registry, dispatch glue, and validation hooks for every wire-protocol command.
src/mongo/s/mongos_main.cpp ~1.7 k mongos startup, signal handling, and shutdown.
src/mongo/db/BUILD.bazel ~120 KB The build description for the data-side server.

Tests

  • C++ unit test files: 1,713 (*_test.cpp under src/mongo/).
  • JavaScript tests under jstests/: 7,372 files.
  • Suite definitions: see buildscripts/resmokeconfig/suites/ for core, replica_sets, sharding, concurrency, and the many specialized variants.
  • Test-to-code ratio for C++: ~1 test file per ~5 source files by file count.

Dependencies

The vendored third-party tree under src/third_party/ contains 56+ libraries, including WiredTiger (the storage engine), ASIO (transport), gRPC, SpiderMonkey (the shell's JS engine), Boost, and BSON test inputs. Major upstream tracking is documented in README.third_party.md and the vendoring policy is enforced by buildscripts/ linters.

Per-subsystem signals

Each domain page (under features/, systems/, and applications/) carries its own file count, line count, and active-contributor byline. The numbers above are the cross-cutting summary.

See Lore for the historical narrative and Maintainers for ownership.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

By the numbers – MongoDB wiki | Factory