---
name: "mongoc_collection_keys_to_index_string"
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_keys_to_index_string"
---

# mongoc\_collection\_keys\_to\_index\_string(3)

## SYNOPSIS

```
char *
mongoc_collection_keys_to_index_string (const bson_t *keys);
```

## PARAMETERS

- •

  **keys**: A *bson\_t*. This is expected to match the form of the **key** field in the *createIndexes* command.

## DESCRIPTION

This function returns the canonical stringification of a given key specification. See *Manage Collection Indexes* for example usage.

It is a programming error to call this function on a non-standard index, such one other than a straight index with ascending and descending.

## RETURNS

A string that should be freed with *bson\_free()*.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
