1MONGOC_CLIENT_ENCRYPTIONM_OCNRGEOACT_EC_LEINECNRlTYi_PbETmNEoCDnR_gYCoPOcTLILOENC_TCIROENA(T3E)_ENCRYPTED_COLLECTION(3)
2
3
4

SYNOPSIS

6          mongoc_collection_t*
7          mongoc_client_encryption_create_encrypted_collection (
8                mongoc_client_encryption_t *enc,
9                mongoc_database_t *database,
10                const char *name,
11                const bson_t *in_options,
12                bson_t *out_options,
13                const char *kms_provider,
14                const bson_t *opt_masterKey,
15                bson_error_t *error)
16            BSON_GNUC_WARN_UNUSED_RESULT;
17
18       Create  a  new collection with Queryable Encryption enabled. Requires a
19       valid mongoc_client_encryption_t object to operate.
20
21       New in version 1.24.0.
22
23
24       SEE ALSO:
25          This     function     is     a     convenience     API      wrapping
26          mongoc_database_create_collection().
27

PARAMETERS

29enc:  The  mongoc_client_encryption_t to be used to configure encryp‐
30         tion for the new collection.
31
32database: The mongoc_database_t in which the new collection  will  be
33         created.
34
35name: The name of the new collection.
36
37in_options: The options for the new collection. (See below).
38
39out_options:  An  optional output option for the final create-collec‐
40         tion options. Should point to storage for a  bson_t.  The  pointed-to
41         object must be destroyed by the caller. If NULL, has no effect.
42
43kms_provider:  The name of the KMS provider to use for generating new
44         data encryption keys for encrypted fields within the collection.
45
46opt_masterKey: If provided, used as the masterkey  option  when  data
47         encryption      keys      need      to      be     created.     (See:
48         mongoc_client_encryption_datakey_opts_set_masterkey())
49
50error:  Optional  output  parameter  pointing  to   storage   for   a
51         bson_error_t.  If an error occurs, will be initialized with error in‐
52         formation.
53

RETURNS

55       If successful, this function returns a new mongoc_collection_t  object.
56       Upon  failure,  returns NULL and initializes *error with an error indi‐
57       cating the reason for failure. The returned collection object  must  be
58       freed by the caller.
59

CREATION OPTIONS

61       The  in_options  parameter  behaves similarly to the opts parameter for
62       mongoc_database_create_collection(), which accepts the options for  the
63       create  MongoDB command (Documented here).  The in_options document ac‐
64       cepted here is different in one important way:
65
66       The $.encryptedFields.fields array is required by this  function,  and,
67       unlike the schema documented for the create command, accepts a value of
68       null for the keyId parameter on each array element.
69
70       This function has the following as-if effect:
71
72       1. A new set of options O will be created based on in_options.
73
74       2. For each element F in the $.encryptedFields.fields array of O:
75
76          1. If F contains a "keyId": null element, a new data encryption  key
77             K_f     will     be     created     as-if    by    calling    the
78             mongoc_client_encryption_create_datakey(), using the relevant ar‐
79             guments  that  were  given to mongoc_client_encryption_create_en‐
80             crypted_collection.
81
82          2. The ID of K_f will be used to replace the "keyId":  null  element
83             within F.
84
85       3. A collection will be created using the options O.
86
87       4. If out_options is not NULL, O will be written to out_options.
88

AUTHOR

90       MongoDB, Inc
91
93       2017-present, MongoDB, Inc
94
95
96
97
981.25.1                 MONGOC_CLINEoNvT_0E8N,CR2Y0P2T3ION_CREATE_ENCRYPTED_COLLECTION(3)
Impressum