MONGOC_CLIENT..._SET_PRECISION(3)

✨ MONGOC_CLIENT..._SET_PRECISION ✨

okay so bestie, this one lives in libmongoc (that's the MongoDB C driver, mwah) and it's a function that sets the precision on your range encryption options. group chat version: it's the little knob you twist so your encrypted numbers know how many digits to care about πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

void
mongoc_client_encryption_encrypt_range_opts_set_precision (
     mongoc_client_encryption_encrypt_range_opts_t *range_opts, int32_t precision);

New in version 1.24.0. like, she's a fresh addition, respect her 🫢


so what does she actually do? she sets the precision for explicit encryption. that's it, that's the job πŸ’–

only applies when the algorithm you set via mongoc_client_encryption_encrypt_opts_set_algorithm() is "Range". it is an error to set precision when the algorithm is not "Range". so don't do that, bestie, the library will genuinely be upset with you 😭

precision can only be set with double or decimal128 fields. it is an error to set precision if the type of the encryptedFields in the destination collection is not double or decimal128. type check first, slay after ✨

for double and decimal128 fields, min/max/precision must all be set, or all be unset. no mixing and matching, it's an all-or-nothing vibe, no cap 🌸

precision must match the value set in the encryptedFields of the destination collection. it is an error to set a different value. mismatched numbers = chaos = not the energy we're bringing today πŸ’€


πŸ¦‹ PARAMETERS πŸ¦‹

  • range_opts β€” a mongoc_client_encryption_encrypt_range_opts_t. the little options struct you're decorating πŸŽ€
  • precision β€” a non-negative precision. negative? absolutely not, that's not the move πŸ™ˆ

🌈 SEE ALSO 🌈

  • mongoc_client_encryption_encrypt_range_opts_set_min()
  • mongoc_client_encryption_encrypt_range_opts_set_max()
  • mongoc_client_encryption_encrypt_range_opts_t

(go read those too, they're the min/max siblings and they're lowkey iconic πŸ‘‘)


πŸ’œ AUTHOR πŸ’œ

MongoDB, Inc β€” yes, that MongoDB, the whole company, showing up as the author like main character energy 🧚

2009-present, MongoDB, Inc.


ok that's the whole page bestie, go forth and set your precision correctly, iykyk πŸ’…πŸ”₯

sign-off szn: this is from libmongoc, version 2.5.6, and it's dated Oct 09, 2026 β€” screenshot it, cite it, love it πŸŽ€πŸ’–

πŸ“¦ where this page comes from