SYNOPSIS

#include <mongoc.h>

mongoc_client_t * client;
mongoc_collection_t * collection;

client = mongoc_client_new(uri_string);

collection =
   mongoc_client_get_collection (client, "db_name", "collection_name");

DESCRIPTION

mongoc_collection provides access to a MongoDB collection. This handle is useful for actions for most CRUD operations, I.e. insert, update, delete, find, etc.

READ PREFERENCES & WRITE CONCERNS

Read preferences and write concerns are inherited from the parent client. They can be overridden by set_* commands if so desired.

LIFECYCLE

It is an error to call mongoc_collection_destroy(3) on a collection that has operations pending. It is required that you release mongoc_cursor(7) structures before calling mongoc_collection_destroy(3).

SEE ALSO

AUTHORS

This page was written by MongoDB Inc.