mongoc_installing - Man Page


Much of this section of documentation has been rewritten and moved: Obtaining the MongoDB C Driver Libraries

Supported Platforms


Moved: mongo-c-driver Platform Support

Install Libmongoc with a Package Manager


Moved: Installing Prebuilt MongoDB C Driver Libraries

Install Libbson with a Package Manager


Moved: Installing Prebuilt MongoDB C Driver Libraries

Docker Image

You can find a Docker image in Docker Hub along with example usage of using libmongoc to ping a MongoDB database from within a Docker container.

Build Environment


Moved: Building the C Driver Libraries from Source

Uninstalling the installed components

There are two ways to uninstall the components that have been installed.  The first is to invoke the uninstall program directly.  On Linux/Unix:

$ sudo /usr/local/share/mongo-c-driver/

On Windows:

$ C:\mongo-c-driver\share\mongo-c-driver\uninstall.bat

The second way to uninstall is from within the build directory, assuming that it is in the exact same state as when the install command was invoked:

$ sudo cmake --build . --target uninstall

The second approach simply invokes the uninstall program referenced in the first approach.

Dealing with Build Failures

If your attempt to build the C driver fails, please see the README for instructions on requesting assistance.

Additional Options for Integrators

In the event that you are building the BSON library and/or the C driver to embed with other components and you wish to avoid the potential for collision with components installed from a standard build or from a distribution package manager, you can make use of the BSON_OUTPUT_BASENAME and MONGOC_OUTPUT_BASENAME options to cmake.

$ cmake -DBSON_OUTPUT_BASENAME=custom_bson -DMONGOC_OUTPUT_BASENAME=custom_mongoc ..

The above command would produce libraries named and (or with the extension appropriate for the build platform).  Those libraries could be placed in a standard system directory or in an alternate location and could be linked to by specifying something like -lcustom_mongoc -lcustom_bson on the linker command line (possibly adjusting the specific flags to those required by your linker).


MongoDB, Inc


Mar 06, 2024 1.26.1 libmongoc