mongoc_collection_create_index(3)

MONGOC_COLLECTION_CREATE_INDEX(3) libmongoc MONGOC_COLLECTION_CREATE_INDEX(3)

Warning:

Deprecated since version 1.8.0: See Manage Collection Indexes <https://www.mongodb.com/docs/languages/c/c-driver/current/libmongoc/guides/manage-collection-indexes/> for alternatives.



SYNOPSIS

bool
mongoc_collection_create_index (mongoc_collection_t *collection,

const bson_t *keys,
const mongoc_index_opt_t *opt,
bson_error_t *error);


PARAMETERS

  • collection: A mongoc_collection_t <>.
  • keys: A bson_t <https://www.mongoc.org/libbson/current/bson_t.html>.
  • opt: A mongoc_index_opt_t.
  • error: An optional location for a bson_error_t <> or NULL.

Author

MongoDB, Inc

Copyright

2009-present, MongoDB, Inc.

February 10, 2026 1.30.7