Menu

Home

Sans Pareil Technologies, Inc.

BSON C++ API

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:

  • C++98 (C++11 branch under branches in subversion)
  • Poco C++ Libraries. The current sources has the Poco::Util JSON classes which will be part of Poco 1.5 release. Once 1.5 release is final, we will remove the JSON classes from the sources in subversion.
  • C++ Template Unit Test Framework TUT. The header files for the unit test framework are included along with the project sources, hence no separate download or install is required to run the Unit Tests.
  • Qt required only for qmake. The Qt API itself is not used in the API, although it is an excellent API. We use Poco to provide most of the features that QtCore does.

[Release Notes]

API Specifications

Building

The API has been built and tested on the following platforms:

  • Mac OS X Mountain Lion - Xcode 4.5 (LLVM 3.1)
  • Solaris 11 - GCC 4.7.2 32/64 bit, SunStudio 12.2 32 bit
  • Windows 7 - MSVC 2010 32 bit, MSVC 2012 64 bit

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

Test Application

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.

Project Members:


Related

Wiki: Release Notes