1MONGOC_DATABASE_T(3) libmongoc MONGOC_DATABASE_T(3)
2
3
4
6 mongoc_database_t - mongoc_database_t
7
8 MongoDB Database Abstraction
9
11 typedef struct _mongoc_database_t mongoc_database_t;
12
13 mongoc_database_t provides access to a MongoDB database. This handle is
14 useful for actions a particular database object. It is not a container
15 for mongoc_collection_t structures.
16
17 Read preferences and write concerns are inherited from the parent
18 client. They can be overridden with mongoc_database_set_read_prefs()
19 and mongoc_database_set_write_concern().
20
22 #include <mongoc/mongoc.h>
23
24 int
25 main (int argc, char *argv[])
26 {
27 mongoc_database_t *database;
28 mongoc_client_t *client;
29
30 mongoc_init ();
31
32 client = mongoc_client_new ("mongodb://localhost/");
33 database = mongoc_client_get_database (client, "test");
34
35 mongoc_database_destroy (database);
36 mongoc_client_destroy (client);
37
38 mongoc_cleanup ();
39
40 return 0;
41 }
42
44 MongoDB, Inc
45
47 2017-present, MongoDB, Inc
48
49
50
51
521.24.3 Aug 17, 2023 MONGOC_DATABASE_T(3)