MONGOC_CLIENT...UTO_ENCRYPTION(3)

πŸ¦‹ mongoc_client_pool_enable_auto_encryption β€” libmongoc, bestie πŸ’…

okay so this is a page from libmongoc and it's about turning on automatic client-side encryption for a whole client pool. Very main-character function. Let's get into it ✨


✨ SYNOPSIS ✨

bool
mongoc_client_pool_enable_auto_encryption (mongoc_client_pool_t *pool,
                                           mongoc_auto_encryption_opts_t* opts,
                                           bson_error_t* error);

πŸ’– DESCRIPTION πŸ’–

So literally what this does is enable automatic client side encryption on a mongoc_client_pool_t. Slay. πŸŽ€

But heads up: this requires libmongoc to be built with support for In-Use Encryption. Check out the In-Use Encryption docs for the instructions on how to enable In-Use Encryption in libmongoc β€” no cap, you can't skip that step. 🫢

Automatic encryption is an enterprise-only feature, and it only applies to operations on a collection. It is not supported for operations on a database or view, and operations that aren't bypassed will result in error. πŸ’€ So if you wanna bypass automatic encryption for all operations, do it with mongoc_auto_encryption_opts_set_bypass_auto_encryption() in opts.

Also, automatic encryption requires the authenticated user to have the listCollections privilege action. iykyk πŸ”‘

And ngl, enabling automatic encryption reduces the maximum message size and may have a negative performance impact. Worth knowing before you turn it on, fr fr. πŸ¦‹


πŸ‘‘ PARAMETERS πŸ‘‘

  • client β€” a mongoc_client_t. (yes bestie, that's what it says πŸ’…)
  • opts β€” a required mongoc_auto_encryption_opts_t. Not optional. Do not forget it. πŸ™ˆ
  • error β€” a bson_error_t which is set on error.

🌈 RETURNS 🌈

Returns true if successful. Returns false and sets error otherwise. Periodt. ⭐

🌸 SEE ALSO 🌸

  • mongoc_auto_encryption_opts_t
  • mongoc_client_enable_auto_encryption()
  • In-Use Encryption for libmongoc
  • The MongoDB Manual for Client-Side Field Level Encryption
  • The MongoDB Manual for Queryable Encryption

πŸŽ€ AUTHOR πŸŽ€

MongoDB, Inc

2009-present, MongoDB, Inc.


cutest little sign-off ever: this was libmongoc 2.5.6, dated Oct 09, 2026, brought to you by MongoDB, Inc. stay encrypted, stay iconic, mwah πŸ’‹πŸ”₯
πŸ“¦ where this page comes from