Collection & Data API#
- <amongoc/collection.h> (header file)#
Defines a collection handle type and CRUD APIs.
Types#
-
type amongoc_collection#
An incomplete type that acts as a handle on a collection within a database and associated client. Create using
amongoc_collection_new()
and destroy withamongoc_collection_delete()
-
const amongoc_status_category_vtable amongoc_crud_category#
A status category related to CRUD operations.
-
enum amongoc_crud_errc#
-
enumerator amongoc_crud_okay#
Operation was succsesful
-
enumerator amongoc_crud_write_errors#
The operation generated one or more write errors.
-
enumerator amongoc_crud_okay#
-
struct [[zero_initializable]] amongoc_write_result#
A result type produced by certain collection operations.
Delete with
amongoc_write_result_delete
.
-
struct amongoc_write_error#
Delete with
amongoc_write_error_delete
.
-
struct amongoc_write_error_vec#
Functions & Macros#
See also
Refer to the Collection Operations page for methods that perform CRUD operations on a collection.
- amongoc_collection *amongoc_collection_new(
- amongoc_client *client,
- __string_convertible db_name,
- __string_convertible coll_name,
Create a new handle to a database collection. Does not perform any I/O, just creates a client-side handle.
- Parameters:
client – A valid client for the new collection handle. The client object must outlive the returned collection handle.
db_name – Name of the database in the MongoDB server that will own the collection.
coll_name – The name of the collection in the database.
The returned collection handle must eventually be given to
amongoc_collection_delete()
-
void amongoc_collection_delete(amongoc_collection *coll)#
Release any client-side resources associated with the collection handle.