Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
107 lines (65 sloc) 2.63 KB
.. include:: /includes/unicode-checkmark.rst
MongoDB C Driver
.. default-domain:: mongodb
.. contents:: On this page
:backlinks: none
:depth: 1
:class: twocols
The MongoDB C Driver, also known as “libmongoc”, is the official client library
for C applications, and provides a base for MongoDB drivers in higher-level
The library is compatible with all major platforms. It depends on libbson
to create and parse BSON data.
- `Tutorial <>`__
- `Usage Guide <>`__
- `API Reference <>`_
- `Changelog <>`__
- `Source Code <>`__
See `Installing the MongoDB C Driver (libmongoc) and BSON library (libbson)
Connect to MongoDB Atlas
To connect to a `MongoDB Atlas <>`_ cluster, use the `Atlas connection string <>`__ for your cluster:
.. code-block:: c
#include <mongoc/mongoc.h>
main (int argc, char *argv[])
mongoc_database_t *database;
mongoc_client_t *client;
mongoc_init ();
client = mongoc_client_new(
database = mongoc_client_get_database (client, "test");
mongoc_database_destroy (database);
mongoc_client_destroy (client);
mongoc_cleanup ();
return 0;
See `Advanced Connections <>`__
for more ways to connect.
MongoDB Compatibility
.. include:: /includes/extracts/c-driver-compatibility-matrix-mongodb.rst
.. include:: /includes/mongodb-compatibility-table-c.rst
.. include:: /includes/older-server-versions-unsupported.rst
Language Compatibility
.. include:: /includes/extracts/c-driver-compatibility-matrix-language.rst
.. include:: /includes/language-compatibility-table-c.rst
How to get help
- Join our `Google Group <>`__.
- Ask on `Stack Overflow <>`__.
- Visit our `Support Channels <>`__.
- File a bug or feature request on `JIRA <>`__.
You can’t perform that action at this time.