Skip to content
C Driver for MongoDB
Branch: master
Clone or download
Pull request Compare This branch is 204 commits behind 10gen-archive:master.
Latest commit 6396e9d Jan 8, 2013
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs CDRIVER-187 C driver 0.7.1 release Jan 7, 2013
src don't Jan 8, 2013
test CDRIVER-185 Not properly validate if Collection has single-length name. Jan 7, 2013
.astylerc minor: astyle Jul 29, 2011
.gitignore CDRIVER-148 Memory leak using write_concern Jun 29, 2012
APACHE-2.0.txt Add a copy of the Apache 2 license. Apr 16, 2010 CDRIVER-173 Support github contributing guidelines Nov 14, 2012 CDRIVER-187 C driver 0.7.1 release Jan 7, 2013
Makefile CDRIVER-182 C driver 0.7 release Nov 27, 2012 CDRIVER-182 C driver 0.7 release Nov 28, 2012
SConstruct minor: license Mar 20, 2012
doxygenConfig CDRIVER-187 C driver 0.7.1 release Jan 7, 2013 CDRIVER-165 BCON Notation for insert key/value only when value meets … Aug 9, 2012

MongoDB C Driver

This is then 10gen-supported MongoDB C driver. There are two goals for this driver. The first is to provide a strict, default compilation option for ultimate portability, no dependencies, and generic embeddability.

The second is to support more advanced, platform-specific features, like socket timeout, by providing an interface for platform-specific modules.

Until the 1.0 release, this driver should be considered alpha. Keep in mind that the API will be in flux until then.


Documentation exists in the project's docs folder. You can read the latest docs online at (

The docs are built using Sphinx and Doxygen. If you have these tools installed, then you can build the docs with scons:

scons docs

The html docs will appear in docs/html.


First check out the version you want to build. Always build from a particular tag, since HEAD may be a work in progress. For example, to build version 0.7, run:

git checkout v0.7

You can then build the driver with scons:


For more build options, see the docs.

Running the tests

Make sure that you're running mongod on on the default port (27017). The replica set test assumes a replica set with at least three nodes running at and starting at port 30000. Note that the driver does not recognize 'localhost' as a valid host name.

To compile and run the tests:

scons test

Error Handling

Most functions return MONGO_OK or BSON_OK on success and MONGO_ERROR or BSON_ERROR on failure. Specific error codes and error strings are then stored in the err and errstr fields of the mongo and bson objects. It is the client's responsibility to check for errors and handle them appropriately.


You can report bugs, request new features, and view this driver's roadmap using JIRA.


  • Kyle Banker - development through version 0.6.
  • Gergely Nagy - Non-null-terminated string support.
  • Josh Rotenberg - Initial Doxygen setup and a significant chunk of documentation.


Unless otherwise specified in a source file, sources in this repository are published under the terms of the Apache License version 2.0, a copy of which is in this repository as APACHE-2.0.txt.

You can’t perform that action at this time.