.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "MONGOC_CLIENT_ENCRYPTION_CREATE_ENCRYPTED_COLLECTION" "3" "May 07, 2024" "1.27.1" "libmongoc" .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 .sp .EX 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) BSON_GNUC_WARN_UNUSED_RESULT; .EE .UNINDENT .UNINDENT .sp Create a new collection with \fI\%Queryable Encryption\fP enabled. Requires a valid \fI\%mongoc_client_encryption_t\fP object to operate. .sp New in version 1.24.0. .sp \fBSEE ALSO:\fP .INDENT 0.0 .INDENT 3.5 This function is a convenience API wrapping \fI\%mongoc_database_create_collection()\fP\&. .UNINDENT .UNINDENT .SH PARAMETERS .INDENT 0.0 .IP \(bu 2 \fBenc\fP: The \fI\%mongoc_client_encryption_t\fP to be used to configure encryption for the new collection. .IP \(bu 2 \fBdatabase\fP: The \fI\%mongoc_database_t\fP in which the new collection will be created. .IP \(bu 2 \fBname\fP: The name of the new collection. .IP \(bu 2 \fBin_options\fP: The options for the new collection. (See below). .IP \(bu 2 \fBout_options\fP: An optional output option for the final create\-collection options. Should point to storage for a \fI\%bson_t\fP\&. The pointed\-to object must be destroyed by the caller. If \fBNULL\fP, has no effect. .IP \(bu 2 \fBkms_provider\fP: The name of the KMS provider to use for generating new data encryption keys for encrypted fields within the collection. .IP \(bu 2 \fBopt_masterKey\fP: If provided, used as the masterkey option when data encryption keys need to be created. (See: \fI\%mongoc_client_encryption_datakey_opts_set_masterkey()\fP) .IP \(bu 2 \fBerror\fP: Optional output parameter pointing to storage for a \fI\%bson_error_t\fP\&. If an error occurs, will be initialized with error information. .UNINDENT .SH RETURNS .sp If successful, this function returns a new \fI\%mongoc_collection_t\fP object. Upon failure, returns \fBNULL\fP and initializes \fB*error\fP with an error indicating the reason for failure. The returned collection object must be freed by the caller. .SH CREATION OPTIONS .sp The \fBin_options\fP parameter behaves similarly to the \fBopts\fP parameter for \fI\%mongoc_database_create_collection()\fP, which accepts the options for the \fBcreate\fP MongoDB command (\fI\%Documented here\fP). The \fBin_options\fP document accepted here is different in one important way: .sp The \fB$.encryptedFields.fields\fP array is \fIrequired\fP by this function, and, unlike the schema documented for the \fBcreate\fP command, accepts a value of \fBnull\fP for the \fBkeyId\fP parameter on each array element. .sp This function has the following as\-if effect: .INDENT 0.0 .IP 1. 3 A new set of options O will be created based on \fBin_options\fP\&. .IP 2. 3 For each element F in the \fB$.encryptedFields.fields\fP array of O: .INDENT 3.0 .IP 1. 3 If F contains a \fB\(dqkeyId\(dq: null\fP element, a new data encryption key K_f will be created as\-if by calling the \fI\%mongoc_client_encryption_create_datakey()\fP, using the relevant arguments that were given to \fBmongoc_client_encryption_create_encrypted_collection\fP\&. .IP 2. 3 The ID of K_f will be used to replace the \fB\(dqkeyId\(dq: null\fP element within F\&. .UNINDENT .IP 3. 3 A collection will be created using the options O\&. .IP 4. 3 If \fBout_options\fP is not \fBNULL\fP, O will be written to \fBout_options\fP\&. .UNINDENT .SH AUTHOR MongoDB, Inc .SH COPYRIGHT 2017-present, MongoDB, Inc .\" Generated by docutils manpage writer. .