This is a DOM style C++ API for working with BSON data. The MongoDB C++ API is a bit cumbersome for developing client applications. Sans Pareil Technologies, Inc. uses BSON as the data format in both server and client applications, and we needed an easy to use API to perform CRUD operations on data. A simple callback based ODM framework, and a slightly more convenient ODM framework is available as part of the API. The API design follows the design of the classes used in developing the desktop application, but is independent of it (the desktop application API uses MongoDB C++ API).
The API has the following dependencies:
The API has been built and tested on the following platforms:
Scripts are provided under the bin directory in the subversion repository. You may use one of those as a sample to build the library. You can also load the bson.pro (and optionally test.pro) files in Qt Creator on any platform and build the library as appropriate.
#!/bin/ksh
QMAKE=/usr/local/qt/bin/qmake
BUILD_DIR=`dirname $0`/../build
LIB_DIR=$BUILD_DIR/lib
TEST_DIR=$BUILD_DIR/test
if [ ! -d $LIB_DIR ]; then mkdir -p $LIB_DIR; fi
if [ ! -d $TEST_DIR ]; then mkdir -p $TEST_DIR; fi
(cd $LIB_DIR; $QMAKE ../../bson.pro; gmake -j4)
if [ $? -eq 0 ]
then
(cd $TEST_DIR; $QMAKE ../../test.pro; gmake -j4; ./UnitTest)
fi
A test application (Windows only at present) is available under the downloads area. The API has been tested on Windows 7 32 bit with MSVC 2010 and 64 bit with MSVC 2012. The bsontest project included in the application was initially created for MSVC 2010 and then used to test with 2012 (without upgrading the format). Note that the pre-built Poco and uma::bson binaries were built using the same environments mentioned above, so you may need the same if you are testing on your own.