mongoc_collection_create_index (3) - Linux Manuals

mongoc_collection_create_index: This function will request the creation of a new index.

NAME

mongoc_collection_create_index() - This function will request the creation of a new index.

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 \&.

opt
A mongoc_index_opt_t.

error
An optional location for a bson_error_t or NULL \&.

DESCRIPTION

This function will request the creation of a new index.

This function will use the createIndexes command if available on the MongoDB server. If not, it will fallback to inserting into system.indexes for compatibility with MongoDB <= 2.4.

See mongoc_index_opt_t for options on creating indexes.

ERRORS

Errors are propagated via the error parameter.

RETURNS

true on success, false on failure and error is set.

COLOPHON

This page is part of MongoDB C Driver. Please report any bugs at https://jira.mongodb.org/browse/CDRIVER.