---
name: "mongoc_client_encryption_encrypt_range_opts_set_sparsity"
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_client_encryption_encrypt_range_opts_set_sparsity"
---

# mongoc\_client\_encryption\_encrypt\_range\_opts\_set\_sparsity(3)

## SYNOPSIS

```
void
mongoc_client_encryption_encrypt_range_opts_set_sparsity (
     mongoc_client_encryption_encrypt_range_opts_t *range_opts, int64_t sparsity);
```

Added in version 1.24.0.

Sets sparsity for explicit encryption. Only applies when the algorithm set by *mongoc\_client\_encryption\_encrypt\_opts\_set\_algorithm()* is "Range". It is an error to set sparsity when algorithm is not "Range".

Sparsity may be used to tune performance. When omitted, a default value is used.

Sparsity must match the value set in the encryptedFields of the destination collection. It is an error to set a different value.

## PARAMETERS

- •

  **range\_opts**: A *mongoc\_client\_encryption\_encrypt\_range\_opts\_t*

- •

  **sparsity**: A non-negative sparsity.

**SEE ALSO:**

```
mongoc_client_encryption_encrypt_range_opts_t
```

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
