MONGOC_CLIENT_...TED_COLLECTION(3)
πΈ MONGOC_CLIENT_...TED_COLLECTION(3) πΈ
okay bestie, welcome to this libmongoc page π it's giving encryption, it's giving collection creation, and lowkey it's a convenience wrapper. let's get into it β¨
π SYNOPSIS π
mongoc_collection_t*
mongoc_client_encryption_create_encrypted_collection (
mongoc_client_encryption_t *enc,
mongoc_database_t *database,
const char *name,
const bson_t *in_options,
bson_t *out_options,
const char *kms_provider,
const bson_t *opt_masterKey,
bson_error_t *error);
so the vibe is: create a new collection with Queryable Encryption enabled π it requires a valid mongoc_client_encryption_t object to operate, no cap. New in version 1.24.0. π
π SEE ALSO π
this function is a convenience API wrapping mongoc_database_create_collection() π«Ά
π§© PARAMETERS π§©
encβ themongoc_client_encryption_tthat gets used to configure encryption for the new collection πdatabaseβ themongoc_database_tin which the new collection will be created ποΈnameβ the name of the new collection, obviously πin_optionsβ the options for the new collection. (See below). πout_optionsβ an optional output option for the final create-collection options. Should point to storage for abson_t. The pointed-to object must be destroyed by the caller π IfNULL, has no effect.kms_providerβ the name of the KMS provider to use for generating new data encryption keys for encrypted fields within the collection πopt_masterKeyβ if provided, used as the masterkey option when data encryption keys need to be created. (See:mongoc_client_encryption_datakey_opts_set_masterkey()) ποΈerrorβ optional output parameter pointing to storage for abson_error_t. If an error occurs, will be initialized with error information π¨
π RETURNS π
If successful, this function returns a new mongoc_collection_t object π Upon failure, returns NULL and initializes *error with an error indicating the reason for failure π The returned collection object must be freed by the caller β don't forget, bestie π«Ά
π¨ caveat check: the returned collection object must be freed by the caller, and the out_options pointed-to object must be destroyed by the caller. periodt.
π οΈ CREATION OPTIONS π οΈ
the in_options parameter behaves similarly to the opts parameter for mongoc_database_create_collection(), which accepts the options for the create MongoDB command (Documented here). the in_options document accepted here is different in one important way:
the $.encryptedFields.fields array is required by this function, and, unlike the schema documented for the create command, accepts a value of null for the keyId parameter on each array element π
this function has the following as-if effect:
- a new set of options
Owill be created based onin_options⨠- for each element
Fin the$.encryptedFields.fieldsarray ofO:- if
Fcontains a"keyId": nullelement, a new data encryption keyK_fwill be created as-if by calling themongoc_client_encryption_create_datakey(), using the relevant arguments that were given tomongoc_client_encryption_create_encrypted_collectionπ - the ID of
K_fwill be used to replace the"keyId": nullelement withinFπ«°
- if
- a collection will be created using the options
Oπ - if
out_optionsis notNULL,Owill be written toout_optionsπ
βοΈ AUTHOR βοΈ
MongoDB, Inc β iconic, honestly π
Β©οΈ COPYRIGHT Β©οΈ
2009-present, MongoDB, Inc. π
kisses bestie, this page is from libmongoc, version 2.5.6, dated Oct 09, 202 ππ¦β¨ slay and read your man pages responsibly π
π¦ where this page comes from
- epel 10: mongo-c-driver-devel 2.5.6-1.el10_3 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms