Skip to content

kvidzibo/mongo-c-driver

 
 

Repository files navigation

mongo-c-driver

About

mongo-c-driver is a client library written in C for MongoDB.

There are absolutely no guarantees of API/ABI stability at this point. But generally, we won't break API/ABI unless we have good reason.

mongo-c-driver depends on Libbson. Libbson will automatically be built if you do not have it installed on your system.

If you are looking for the legacy C driver, it can be found in the legacy branch.

Documentation / Support / Feedback

The documentation is available at http://api.mongodb.org/c/current/. For issues with, questions about, or feedback for libmongoc, please look into our support channels. Please do not email any of the libmongoc developers directly with issues or questions - you're more likely to get an answer on the mongodb-user list on Google Groups.

Bugs / Feature Requests

Think you’ve found a bug? Want to see a new feature in libmongoc? Please open a case in our issue management tool, JIRA:

Bug reports in JIRA for all driver projects (i.e. CDRIVER, CSHARP, JAVA) and the Core Server (i.e. SERVER) project are public.

Security Vulnerabilities

If you’ve identified a security vulnerability in a driver or any other MongoDB project, please report it according to the instructions here.

Building from Release Tarball

Unless you intend on contributing to the mongo-c-driver, you will want to build from a release tarball.

The most current release is 1.1.0-rc0 which you can download here. mongo-c-driver-1.1.0-rc0.tar.gz.

To build on UNIX-like systems, do the following:

$ tar xzf mongo-c-driver-1.1.0-rc0.tar.gz
$ cd mongo-c-driver-1.1.0-rc0
$ ./configure
$ make
$ sudo make install

To see all of the options available to you during configuration, run:

$ ./configure --help

To build on Windows Vista or newer with Visual Studio 2010, do the following:

cd mongo-c-driver-1.1.0-rc0
cd src\libbson
cmake -DCMAKE_INSTALL_PREFIX=C:\usr -G "Visual Studio 10 Win64" .
msbuild.exe ALL_BUILD.vcxproj
msbuild.exe INSTALL.vcxproj
cd ..\..
cmake -DCMAKE_INSTALL_PREFIX=C:\usr -DBSON_ROOT_DIR=C:\usr -G "Visual Studio 10 Win64" .
msbuild.exe ALL_BUILD.vcxproj
msbuild.exe INSTALL.vcxproj

Building From Git

mongo-c-driver contains a copy of libbson in the case that your system does not already have libbson installed. The configure script will detect if libbson is not installed and install it too.

Dependencies

Fedora:

$ sudo yum install git gcc automake autoconf libtool

Debian:

$ sudo apt-get install git gcc automake autoconf libtool

FreeBSD:

$ su -c 'pkg install git gcc automake autoconf libtool'

Fetch Sources and Build

You can use the following to checkout and build mongo-c-driver:

git clone https://github.com/mongodb/mongo-c-driver.git
cd mongo-c-driver
./autogen.sh
make
sudo make install

In standard automake fasion, ./autogen.sh only needs to be run once. You can use ./configure directly going forward. Also, see ./configure --help for all configure options.

Building on Windows

Currently, the cmake build system for mongo-c-driver does not build the libbson package as well. This needs to be done manually with cmake.

SSL is supported through the use of OpenSSL. SASL is not currently supported but is planned. To enable OpenSSL support, install the appropriate OpenSSL for Windows from here. The instructions below assume 64-bit builds, so you would want to get the version for "Win64 OpenSSL 1.0.1f" which includes libraries and headers.

If you are building from git, and not a release tarball, you also need to initialize the git submodule for libbson:

git submodule init
git submodule update

Then proceed to build and install libbson using cmake and Visual Studio's command line tool, msbuild.exe. You can of course open these project files from Visual Studio as well:

cd src\libbson
cmake -DCMAKE_INSTALL_PREFIX=C:\usr -G "Visual Studio 10 Win64" .
msbuild.exe ALL_BUILD.vcxproj
msbuild.exe INSTALL.vcxproj
cd ..\..
cmake -DCMAKE_INSTALL_PREFIX=C:\usr -DBSON_ROOT_DIR=C:\usr -G "Visual Studio 10 Win64" .
msbuild.exe ALL_BUILD.vcxproj
msbuild.exe INSTALL.vcxproj

Generating the Docs

To generate the documentation you must install the yelp-tools package. On Linux this package can be found in the package manager for your distribution, on OSX we recommend using TingPing's homebrew-gnome tap.

Then use the following ./configure options:

  • --enable-html-docs - builds the HTML documentation
  • --enable-man-pages - builds and installs the man-pages.

About

A high-performance MongoDB driver for C

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 94.2%
  • C++ 3.5%
  • Other 2.3%