SYNOPSIS

mongoc_database_t * mongoc_client_get_database (
   mongoc_client_t *client,
   const char      *name);

mongoc_gridfs_t * mongoc_client_get_gridfs (
   mongoc_client_t *client,
   const char      *db,
   const char      *prefix,
   bson_error_t    *error);

mongoc_collection_t * mongoc_client_get_collection (
   mongoc_client_t *client,
   const char      *db,
   const char      *collection);

DESCRIPTION

The mongoc_client_get_database() function shall create a new mongoc_database(7). name is the string name of the database.

The mongoc_client_get_collection() function shall create a new mongoc_collection(7). Note that the db and collection parameters are both string names rather than objects.

The mongoc_client_get_gridfs() function shall create a new mongoc_gridfs(7). The db parameter is the name of the database which the gridfs instance should exist in. The prefix parameter corresponds to the gridfs collection namespacing.

RETURN VALUE

The mongoc_client_get*()_ functions return a pointer to their respective objects. In the case of an error, they return NULL.

ERRORS

get_database and get_collection are both lazy, and as such do not return any errors. get_gridfs ensures relevant indexes, and as such returns errors as mongoc_collection_ensure_index(3).

SEE ALSO

AUTHORS

This page was written by MongoDB Inc.