@@ -59,6 +59,7 @@ Connect to MongoDB Atlas
5959
6060 mongoc_init ();
6161
62+ // Replace the uri string with your MongoDB deployment's connection string.
6263 client = mongoc_client_new(
6364 "mongodb+srv://<username>:<password>@<cluster-url>/test?retryWrites=true&w=majority"
6465 );
@@ -77,6 +78,35 @@ Connect to MongoDB Atlas
7778See `Advanced Connections <http://mongoc.org/libmongoc/current/advanced-connections.html>`__
7879for more ways to connect.
7980
81+ Versioned API
82+ -------------
83+
84+ You can use the `Versioned API
85+ <https://docs.mongodb.com/v5.0/reference/versioned-api/>`__ feature
86+ starting with MongoDB Server version 5.0 and C Driver version 1.18. When
87+ you use the Versioned API feature, you can update your driver or server
88+ without worrying about backward compatibility issues with any commands
89+ covered by the Versioned API. To use this feature, construct a MongoDB
90+ client instance, specifying a version of the Versioned API:
91+
92+ .. code-block:: c
93+
94+ // Replace <connection string> with your MongoDB deployment's connection string.
95+ const char *uri_string = "<connection string>";
96+ mongoc_uri_t *uri;
97+ mongoc_client_t *client;
98+ mongoc_server_api_t *api;
99+ bson_error_t error;
100+
101+ mongoc_init ();
102+
103+ uri = mongoc_uri_new_with_error (uri_string, &error);
104+ client = mongoc_client_new_from_uri (uri);
105+
106+ // Set the version of the Versioned API on the client.
107+ api = mongoc_server_api_new (MONGOC_SERVER_API_V1);
108+ mongoc_client_set_server_api (client, api, &error);
109+
80110Connect to ``localhost``
81111------------------------
82112
0 commit comments