---
name: "mongoc_collection_create_index"
section: "3"
platform: "linux"
package: "libmongoc-doc"
version: "1.30.4-1+deb13u3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/mongoc_collection_create_index"
---

# mongoc\_collection\_create\_index(3)

**WARNING:**

Deprecated since version 1.8.0: See *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*.

- •

  **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.
