1MONGOC_CLIENT_GET_COLLECTION(3) libmongoc MONGOC_CLIENT_GET_COLLECTION(3)
2
3
4
6 mongoc_collection_t *
7 mongoc_client_get_collection (mongoc_client_t *client,
8 const char *db,
9 const char *collection)
10 BSON_GNUC_WARN_UNUSED_RESULT;
11
12 Get a newly allocated mongoc_collection_t for the collection named col‐
13 lection in the database named db.
14
15 TIP:
16 Collections are automatically created on the MongoDB server upon in‐
17 sertion of the first document. There is no need to create a collec‐
18 tion manually.
19
21 • client: A mongoc_client_t.
22
23 • db: The name of the database containing the collection.
24
25 • collection: The name of the collection.
26
28 A newly allocated mongoc_collection_t that should be freed with
29 mongoc_collection_destroy() when no longer in use.
30
32 MongoDB, Inc
33
35 2017-present, MongoDB, Inc
36
37
38
39
401.25.1 Nov 08, 2023 MONGOC_CLIENT_GET_COLLECTION(3)