mongoc_collection_ensure_index() — MongoDB C Driver 1.6.3

- MongoDB C Driver 1.6.3 »
- API Reference »
- mongoc_collection_t

# mongoc_collection_ensure_index()

## Synopsis

    bool
    mongoc_collection_ensure_index (mongoc_collection_t *collection,
                                    const bson_t *keys,
                                    const mongoc_index_opt_t *opt,
                                    bson_error_t *error)
       BSON_GNUC_DEPRECATED_FOR (mongoc_collection_create_index);

## Deprecated

Warning

This function is deprecated and should not be used in new code.

Please use mongoc_collection_create_index() instead.

## 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`.

## Errors

Errors are propagated via the `error` parameter.

Created using Sphinx 1.5.3, based on Sphinx Readable Theme.