mongodb/mongo
MongoDB
MongoDB is a general-purpose, document-oriented database. This repository contains the source for the database server (mongod), the sharding router (mongos), the test shell (jstestshell, formerly the mongo shell), and the supporting tools, build scripts, and JavaScript test suite.
What this codebase is
The project is primarily a large C++20 codebase under src/mongo/, built with Bazel. It includes:
mongod— the database server. Hosts collections, indexes, the query engine, the replication subsystem, and the storage engine (WiredTiger).mongos— the sharding router. Routes client requests across a sharded cluster, drives the cluster's distributed transaction protocol, and tracks routing table information from config servers.jstestshell— a JavaScript shell embedding SpiderMonkey. Used heavily for thejstests/regression suite.embedded— a small library form of the database (stitch_support) intended for embedding inside applications.
The repository also includes the JavaScript regression test suite (jstests/, ~7,000 files), the Python build and test infrastructure (buildscripts/ and evergreen/), the IDL compiler that generates command/parser glue (buildscripts/idl/), and the modules_poc/ tooling that enforces module API boundaries.
Who uses this code
- Server engineers at MongoDB building features for the server, sharding router, query engine, replication system, and storage engine.
- External contributors submitting bug fixes and improvements (see CONTRIBUTING.rst).
- Driver and tooling authors who track wire protocol and command behavior changes.
Quick links
- Architecture overview — the major components and how they fit together.
- Getting started — prerequisites, building, and running.
- Glossary — project-specific vocabulary.
- How to contribute — workflow, testing, debugging, and conventions.
- Applications —
mongod,mongos, the shell. - Features — replication, sharding, the query and aggregation pipelines, transactions, change streams, time-series, indexing, authentication, and storage.
- Systems — BSON, IDL, the network transport, the executor and thread pools, structured logging, and fail points.
Repository top-level layout
| Path | Purpose |
|---|---|
src/mongo/ |
All first-party C++ source for mongod, mongos, the shell, and shared libraries. |
src/third_party/ |
Vendored third-party libraries (WiredTiger, ASIO, gRPC, SpiderMonkey, etc.). |
jstests/ |
JavaScript regression tests run via the resmoke.py test runner. |
buildscripts/ |
Python build, lint, IDL, and test infrastructure. |
evergreen/ |
CI configuration and scripts driving MongoDB's Evergreen build system. |
bazel/ |
Custom Bazel rules and toolchains. |
docs/ |
In-repo design documentation (logging, IDL, futures, replication, etc.). |
modules_poc/ |
Tooling that enforces public/private API visibility across the codebase. |
etc/ |
Configuration templates, signing materials, and ancillary scripts. |
debian/, rpm/ |
Packaging metadata for system installs. |
tools/ |
Auxiliary build and developer tooling. |
Licensing
MongoDB versions released after October 16, 2018 are published under the Server Side Public License (SSPL) v1. Earlier versions were AGPL. Individual files may carry different licenses — see file headers.
External resources
- MongoDB Manual — user-facing documentation.
- MongoDB Wiki on GitHub — additional contributor information.
- Server forum — discussion for server developers.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.