| MONGOC_DATABASE_T(3) | Library Functions Manual | MONGOC_DATABASE_T(3) |
NAME¶
mongoc_database_t - MongoDB Database AbstractionSYNOPSIS¶
typedef struct _mongoc_database_t mongoc_database_t;mongoc_database_t provides access to a MongoDB database. This handle is useful for actions a particular database object. It is not a container for mongoc_collection_t structures.
Read preferences and write concerns are inherited from the parent client. They can be overridden with mongoc_database_set_read_prefs(3) and mongoc_database_set_write_concern(3)
NOTE
It is an error to call mongoc_database_destroy(3)
on a database that has operations pending. It is required that you release
mongoc_cursor_t structures before calling
mongoc_database_destroy
EXAMPLES¶
#include <mongoc.h>
int
main (int argc,
char *argv[])
{
mongoc_database_t *database;
mongoc_client_t *client;
mongoc_init ();
client = mongoc_client_new ("mongodb://localhost/");
database = mongoc_client_get_database (client, "test");
mongoc_database_destroy (database);
mongoc_client_destroy (client);
mongoc_cleanup ();
return 0;
}
COLOPHON¶
This page is part of MongoDB C Driver. Please report any bugs at https://jira.mongodb.org/browse/CDRIVER.| 2016‐10‐12 | MongoDB C Driver |