MongoDB HHVM driver
PHP C++ Hack Other
Latest commit 85a871b Jan 19, 2017 @derickr derickr Merge branch 'v1.2'
Failed to load latest commit information.
benchmarks Only do the simple test, so that the memory leak issue can be shared … Mar 2, 2016
libbson @ fd07431 HHVM-280: Assertion failure in stream_not_found() after failed getmor… Jan 18, 2017
libmongoc @ 60126ee HHVM-280: Assertion failure in stream_not_found() after failed getmor… Jan 18, 2017
scripts HHVM-248: Validate that read preference tags is an array of documents Sep 20, 2016
src/MongoDB HHVM-282: Alphabetize Regex flags when instantiating from BSON Jan 18, 2017
tests Fixed test Jan 13, 2017
.gitignore Added benchmarking code to Git Feb 24, 2016
.gitmodules Update libmongoc to 1.2.0-dev (with SDAM) May 8, 2015
CONTRIBUTING.rst HHVM-136: Make hippo and phongo README/CONTRIBUTING files consistent Nov 12, 2015
ChangeLog.rst Go with 1.2.1 Jan 17, 2017
LICENSE Add Apache 2 license Dec 19, 2014
README.rst libmongoc now checks for the built-in libbson Jul 14, 2016
THIRD_PARTY_NOTICES HHVM-256: Third party notices Nov 28, 2016
bson.cpp Fixed HHVM-281: Fix compile issue with HHVM 3.17 Jan 18, 2017
bson.h HHVM-214: Added missing deserialize handlers for MaxKey and MinKey Oct 17, 2016
config.cmake HHVM-190: Implement APM Specification Oct 24, 2016
ext_mongodb.php HHVM-265: Update Max Staleness implementation Nov 28, 2016
mongodb.cpp master is the 1.3 branch Jan 18, 2017
mongodb.h Make things compile with both HHVM 3.8 and 3.9(dev) Jul 29, 2015
pool.cpp Undefine HHVM's TRACE define to prevent clash with mongo-c-driver Aug 26, 2016
pool.h HHVM-123: Persist connections and SDAM status between requests Apr 28, 2016
run-tests.php Show test counter even if we only show certain result groups Sep 3, 2015
serialization.rst Merge branch 'v1.2' Oct 17, 2016 Initial commit Dec 10, 2014
tutorial.rst Update GitHub URLs for org change and repo rename Oct 23, 2015
utils.cpp HHVM-281: Fix compile issue with HHVM 3.17 Jan 18, 2017
utils.h HHVM-254: Upgrade libbson and libmongoc to 1.5.0 (currently -rc0) Sep 26, 2016



This is the low-level HHVM driver for MongoDB. The API is the same as the PHP driver for MongoDB. The documentation for both of them is the same, and can be found at

The driver is written to be a bare bone layer to talk to MongoDB, and therefore misses many convenience features. Instead, these convenience methods have been split out into a layer written in PHP, the MongoDB Library. Using this library should be your preferred way of interacting with MongoDB.

Please note that the new HHVM and PHP drivers implement a different API from the legacy driver at; therefore existing libraries that use the legacy driver (e.g. Doctrine MongoDB's ODM) will not work with the new drivers.

In the long run, we hope that userland packages will be built atop this driver to implement various APIs (e.g. a BC layer for the existing driver, new fluent interfaces), management utilities (for creating admin utilities and cluster management applications), and other interesting libraries.



Please ensure, that before you install the extension, the following tools are installed: autoconf, automake, and libtool.

Compiling this extension requires the hphpize command, which is available by installing the hhvm-dev package from the HHVM repositories or building HHVM from source.

Besides the extension, we recommend using it in combination with our userland library which is distributed as mongodb/mongodb for Composer.

From a package (.tgz)

Releases of this driver can be found on

Please download the latest .tgz file into a directory, and run the following commands:

mkdir hhvm-mongodb
cd hhvm-mongodb
tar -xvzf ../hhvm-mongodb-1.1.2.tgz
cd hhvm-mongodb-1.1.2
cmake .
make configlib
make -j [number_of_processor_cores] # eg. make -j 4
make install

Building from source

Run the following commands:

git clone --branch master
cd mongo-hhvm-driver/
git submodule update --init --recursive
cmake .
make configlib
make -j [number_of_processor_cores] # eg. make -j 4
make install


In your /etc/hhvm/php.ini, add the following lines (adjusting paths if necessary):




Related Projects