MongoDB C Driver

    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 languages.

    The library is compatible with all major platforms. It depends on libbson to create and parse BSON data.

    See Installing the MongoDB C Driver (libmongoc) and BSON library (libbson).

    To connect to a MongoDB Atlas cluster, use the Atlas connection string for your cluster:

    #include <mongoc/mongoc.h>
    int 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.

    C Driver Version
    MongoDB 4.4
    MongoDB 4.2
    MongoDB 4.0
    MongoDB 3.6
    MongoDB 3.4
    MongoDB 3.2
    MongoDB 3.0
    MongoDB 2.6
    Version 1.17
    Version 1.16
    Version 1.15
    Version 1.14
    Version 1.13
    Version 1.12
    Version 1.11
    Version 1.10
    Version 1.9
    Version 1.8
    Version 1.7
    Version 1.6
    Version 1.5
    Version 1.4
    Version 1.3
    Version 1.2
    Version 1.1
    Version 1.0

    The driver does not support older versions of MongoDB.

    C Driver Versions
    All Versions

    For more information on how to read the compatibility tables, see our guide on MongoDB Compatibility Tables.

    Give Feedback