SYNOPSIS
bool mongoc_collection_ensure_index (mongoc_collection_t *collection, const bson_t *keys, const mongoc_index_opt_t *opt, bson_error_t *error);
DESCRIPTION
The mongoc_collection_ensure_index() function requests that an index on collection be created if one does not already exist.
If an index with the same keys, or name if provided, already exists, this function does nothing.
- error
-
an optional error pointer to store any error data
RETURN VALUE
The mongoc_collection_ensure_index() function returns true if the index was successfully ensured. In the event of an error it returns false an error is set.
ERRORS
Errors are returned through error and may vary based on the server version.
SEE ALSO
AUTHORS
This page was written by MongoDB Inc.