mongo-cxx-driver
AGENTS.md1.1k starsChanged 4 months agoApache-2.0View on GitHub
This project uses CMake. The MongoDB C Driver (which provides the required bson and mongoc libraries) is fetched automatically via FetchContent unless an existing installation prefix is found via find_package() (set CMAKE_PREFIX_PATH accordingly). Use build/ as the CMake binary directory unless otherwise specified by the user. When the user specifies a custom binary directory, always use that directory - do not fall back to build/. The typical configure and build steps (for release and installation): The optional install step: [!IMPORTANT]…
Trending
Quiet since August.about the whole repository
Who's talking about mongodb/mongo-cxx-driver
- conan-io/wishlist“mongocxx/3.0 stable - driver for mongodb”GitHub · Jun 1, 2017 · 7 reactions
- conan-io/conan-center-index“monogo-cxx-driver: add version 4.0.0, update dependencies”GitHub · Nov 26, 2024 · 1 reactions
- microsoft/vcpkg“Package mongo-cxx-driver does not install "include\options" directory”GitHub · Feb 17, 2017 · 1 reactions
- mongodb/libmongocrypt“MONGOCRYPT-955 add AGENTS.md”GitHub · Aug 3, 2026
- mongodb/libmongocrypt“MONGOCRYPT-952 update downloaded C driver to 2.3.3”GitHub · Jul 14, 2026
The biggest 5 of 31 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 31
Talked about on GitHub (31 times).
On GitHub · 31
- Jun 1, 2017mongocxx/3.0 stable - driver for mongodb — conan-io/wishlist7 reactions · 8 comments
- Nov 26, 2024monogo-cxx-driver: add version 4.0.0, update dependencies — conan-io/conan-center-index1 reaction
- Feb 17, 2017Package mongo-cxx-driver does not install "include\options" directory — microsoft/vcpkg1 reaction · 1 comment
- Aug 3, 2026MONGOCRYPT-955 add AGENTS.md — mongodb/libmongocrypt0 reactions
- Jul 14, 2026MONGOCRYPT-952 update downloaded C driver to 2.3.3 — mongodb/libmongocrypt0 reactions
26 more on GitHub
- Jun 26, 2026[mongo-cxx-driver] update to 4.4.0 — microsoft/vcpkg0 reactions
- Jun 4, 2026CDRIVER-6339 Apply new Mixpanel tracker to (almost) all HTML pages — mongodb/mongo-c-driver0 reactions · 1 comment
- May 12, 2026update release branch protection rules step — mongodb/mongo-c-driver0 reactions
- May 11, 2026Upgrade uv.lock dependencies — mongodb/mongo-c-driver0 reactions
- May 6, 2026Add "ignore" paths to EVG config — mongodb/mongo-c-driver0 reactions
- Apr 27, 2026MONGOCRYPT-872 Use `uv tool` to obtain CMake, Ninja, and Python — mongodb/libmongocrypt0 reactions
- Apr 23, 2026[mongo-cxx-driver] update to 4.3.0 — microsoft/vcpkg0 reactions
- Apr 22, 2026[request] mongo-cxx-driver/4.3.0 — conan-io/conan-center-index0 reactions · 2 comments
- Apr 22, 2026[mongo-cxx-driver] update to 4.3.0 — microsoft/vcpkg0 reactions · 1 comment
- Mar 30, 2026Upgrade uv.lock with required-environments — mongodb/mongo-c-driver0 reactions
- Mar 26, 2026[mongo-cxx-driver] update to 4.2.0 — microsoft/vcpkg0 reactions · 1 comment
- Mar 24, 2026[mongo-cxx-driver] update to 4.2.0 — microsoft/vcpkg0 reactions · 1 comment
- Feb 13, 2026CDRIVER-6174 Avoid running packaging tasks during GitHub operations — mongodb/libmongocrypt0 reactions
- Feb 13, 2026CDRIVER-6174 Avoid running packaging tasks during GitHub operations — mongodb/mongo-c-driver0 reactions
- Feb 12, 2026feat(mongo_cxx_driver): add package — brioche-dev/brioche-packages0 reactions
- May 1, 2025[request] mongo-cxx-driver/4.2.0 — conan-io/conan-center-index0 reactions · 1 comment
- May 1, 2025[mongo-cxx-driver] update to 4.1.4 — microsoft/vcpkg0 reactions
- Mar 21, 2022Are there plans to get rid of MongoDB Legacy C++ Driver? — FIWARE/context.Orion-LD0 reactions · 23 comments
- Sep 14, 2020Orthnac Docker & MongoDB Plugin — Doc-Cirrus/orthanc-mongodb0 reactions · 1 comment
- Feb 19, 2020Run test in docker image — telefonicaid/fiware-orion0 reactions · 11 comments
- May 27, 2019TF-IDF — husky-team/husky0 reactions
- Mar 12, 2018No FindBSON.cmake found — mongodb-labs/mangrove0 reactions · 2 comments
- Jun 15, 2017mongocxx 3.0.x is marked as stable — moai/luamongo0 reactions
- Nov 3, 2016The MongoDB mongoclient C++ library is obsolete and no longer available — unbit/uwsgi0 reactions · 3 comments
- Dec 18, 2015Please add VS 2015 support if possible — mnmlstc/core0 reactions · 18 comments
- Aug 16, 2015How to add include folder to PATH + mongo/platform/basic.h NOT FOUND — nmcl/mongo4pi0 reactions · 1 comment
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,736 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
The file
We split this AGENTS.md into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
Use build/ as the CMake binary directory unless otherwise specified by the user.
- Very specific: line 39
Use build/install/ as the custom install prefix when system modification is undesirable or disallowed by the user.
- Very specific: line 71
Test executables test_* are generated under build/src/bsoncxx/test and build/src/mongocxx/test:
- Very specific: line 83
Run a test executable with --help to explore available options (e.g.
- Distinctive: line 135
Always format before committing:
≈ “Common” is an estimate: at least 1 in 5 of the 16,597 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
This file provides guidance to AI coding agents working with code in this repository.
Build System
This project uses CMake.
The MongoDB C Driver (which provides the required bson and mongoc libraries) is fetched automatically via FetchContent unless an existing installation prefix is found via find_package() (set CMAKE_PREFIX_PATH accordingly).
Use build/ as the CMake binary directory unless otherwise specified by the user. When the user specifies a custom binary directory, always use that directory - do not fall back to build/.
The typical configure and build steps (for release and installation):
cmake -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_CXX_STANDARD=17 -B build
cmake --build buildThe optional install step:
cmake --install build[!IMPORTANT] For multi-configuration generators (e.g. "Visual Studio *", "Ninja Multi-Config", etc.), use
--config <config>during the build, install, and test steps instead ofCMAKE_BUILD_TYPE=<config>. TheCMAKE_BUILD_TYPEoption will be ignored by the configuration step. Only useCMAKE_BUILD_TYPEwith single-configuration generators (e.g. Makefile Generators, Ninja, etc.).
Key CMake configuration options (given option=(default|alternatives...)):
-G <generator-name>: specify a build system generator.-D CMAKE_PREFIX_PATH:PATH=<mongo-c-driver-prefix>: specify installation prefixes to search withfind_*()CMake commands (e.g. to use an existing MongoDB C Driver installation)-D CMAKE_INSTALL_PREFIX:PATH=<install-prefix>: install directory used byinstall(). Defaults to:- The
CMAKE_INSTALL_PREFIXenvironment variable when set (with CMake 3.29 or newer). /usr/localon UNIX platforms.C:/Program Files/${PROJECT_NAME}on Windows.- Use
build/install/as the custom install prefix when system modification is undesirable or disallowed by the user.
- The
-D CMAKE_BUILD_TYPE:STRING=<config>: specify the build type on single-configuration generators.-D CMAKE_CXX_STANDARD:STRING=(11|<cxx-standard>): set the C++ standard ("17" or newer is recommended).-D BUILD_SHARED_LIBS:BOOL=(ON|OFF): specify whether to build shared (ON) or static (OFF) libraries.-D BUILD_SHARED_AND_STATIC_LIBS:BOOL=(OFF|ON): enable building both shared and static libraries (requiresBUILD_SHARED_LIBS=ON).-D ENABLE_TESTS:BOOL=(OFF|ON): required to enable and build test targets.-D BUILD_TESTING:BOOL=(OFF|ON): include test targets in the "all" target (whenENABLE_TESTS=ON).
Build performance: Ninja parallelizes builds across all available cores by default; to cap the job count, set CMAKE_BUILD_PARALLEL_LEVEL=<N> in the environment before running cmake --build.
[!NOTE] For local development and testing, use the Debug configure in the Running Tests section instead of the release configure above.
[!NOTE]
.evergreen/scripts/compile.shis the authoritative reference for CI configure-build-install routines. Consult it for details on Ninja generator selection, ccache integration, sanitizer flags (USE_SANITIZER_ASAN,USE_SANITIZER_UBSAN), polyfill selection (BSONCXX_POLYFILL), and other platform-specific options.
Running Tests
Tests use the Catch2 library and require C++14 or newer.
The typical configure and build steps (for testing and development):
cmake -D CMAKE_BUILD_TYPE=Debug -D CMAKE_CXX_STANDARD=17 -D ENABLE_TESTS=ON -D BUILD_TESTING=ON -B build
cmake --build build[!IMPORTANT] The "Debug" config type is recommended for local testing and development. If the project was already built with a different build type and the user has not requested a change, preserve the existing
CMAKE_BUILD_TYPErather than switching toDebug, and advise the user that switching toDebugis recommended for local testing and development. This configure step replaces the release/installation configure above - running both is unnecessary when developing.
Test executables test_* are generated under build/src/bsoncxx/test and build/src/mongocxx/test:
./build/src/bsoncxx/test/test_bson
./build/src/mongocxx/test/test_driver
./build/src/mongocxx/test/test_unified_format_specs
./build/src/mongocxx/test/test_* # other test executables[!IMPORTANT] For multi-configuration generators (e.g. "Visual Studio *", "Ninja Multi-Config"), executables appear under a
<config>/subdirectory (e.g.build/src/bsoncxx/test/Debug/test_bson).
Run a test executable with --help to explore available options (e.g. listing test cases and tags, filtering by name/pattern/tags, etc.).
bsoncxx test cases do not require a live MongoDB server.
Most mongocxx test cases require a live MongoDB server. test_instance is an exception - it tests instance lifecycle via subprocess and does not connect to a server.
Test executables include:
test_bson(bsoncxx): bsoncxx teststest_driver(mongocxx): mongocxx tests (includes legacy spec tests and prose tests)test_unified_format_specs(mongocxx): unified spec test runnertest_instance(mongocxx):mongocxx::instancelifecycle tests (initialization, singleton behavior)test_crud_specs(mongocxx): CRUD spec test runnertest_gridfs_specs(mongocxx): GridFS spec test runnertest_command_monitoring_specs(mongocxx): command monitoring spec test runnertest_client_side_encryption_specs(mongocxx): client-side encryption spec test runnertest_transactions_specs(mongocxx): transactions spec test runnertest_retryable_reads_specs(mongocxx): retryable reads spec test runnertest_read_write_concern_specs(mongocxx): read/write concern spec test runner
Key environment variables controlling test behavior include:
*_TESTS_PATH: path todata/subdirectory containing spec test files (e.g.CRUD_LEGACY_TESTS_PATH,COMMAND_MONITORING_TESTS_PATH).- Explore calls to
run_tests_in_suite()in test code for details.
- Explore calls to
MONGOCXX_TEST_*: additional test environment variables (TLS, AWS, Azure, GCP credentials, etc.).- Integration tests that connect to a live server default to
mongodb://localhost:27017(hardcoded); no URI env var is required for a standard local setup. MONGODB_URIis read by a small number of tests (e.g. search-index tests intest_driver) that skip themselves when it is unset.- Explore calls to
getenv_or_fail()andstd::getenv()in test code for the full list of variables.
- Integration tests that connect to a live server default to
Architecture
The repository provides two libraries, each under src/<library>/:
bsoncxx
A standalone BSON document library with no MongoDB dependency. It wraps the bson library.
mongocxx
The MongoDB C++ Driver. It wraps the mongoc library and depends on the bsoncxx library.
ABI Namespaces
Each library exposes headers under both v_noabi/ (unstable ABI) and v1/ (stable ABI) subdirectories. See etc/coding_guidelines.md for when to use each.
C++ Standard
Minimum is C++11. Polyfills for optional<T> and string_view in bsoncxx::v1::stdx are required up to C++17.
Features in newer standards must be guarded by private macros (e.g. BSONCXX_PRIVATE_INLINE_CXX17).
Before Committing
Always format before committing:
uv run --frozen etc/format.py # C++ source files.
uv run --frozen etc/ruff-format-all.sh # Python scripts.
uv run --frozen etc/shfmt-format-all.sh # Shell scripts.Also run linting when modifying C++ source files:
bash etc/run-clang-tidy.shCode Style
See etc/coding_guidelines.md for detailed rules on:
- Directory structure and component design
- ABI versioning and namespace qualification
- Export macros and inline definitions
- Include ordering (IWYU)
- Exception specification (
noexceptpolicy) - Parameter passing and declaration order
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

