pub unsafe extern "C" fn mongocrypt_ctx_explicit_encrypt_expression_init(
    ctx: *mut mongocrypt_ctx_t,
    msg: *mut mongocrypt_binary_t,
) -> bool
Expand description

Explicit helper method to encrypt a Match Expression or Aggregate Expression. Contexts created for explicit encryption will not go through mongocryptd. Requires query_type to be “range”.

This method expects the passed-in BSON to be of the form: { “v” : FLE2RangeFindDriverSpec }

FLE2RangeFindDriverSpec is a BSON document with one of these forms:

  1. A Match Expression of this form: {$and: [{: {: , {: {: }}]}
  2. An Aggregate Expression of this form: {$and: [{: [, ]}, {: [, ]}]

may be $lt, $lte, $gt, or $gte.

The value of “v” is expected to be the BSON value passed to a driver ClientEncryption.encryptExpression helper.

Associated options for FLE 1:

  • @ref mongocrypt_ctx_setopt_key_id
  • @ref mongocrypt_ctx_setopt_key_alt_name
  • @ref mongocrypt_ctx_setopt_algorithm

Associated options for Queryable Encryption:

  • @ref mongocrypt_ctx_setopt_key_id
  • @ref mongocrypt_ctx_setopt_index_key_id
  • @ref mongocrypt_ctx_setopt_contention_factor
  • @ref mongocrypt_ctx_setopt_query_type
  • @ref mongocrypt_ctx_setopt_algorithm_range

An error is returned if FLE 1 and Queryable Encryption incompatible options are set.

@param[in] ctx A @ref mongocrypt_ctx_t. @param[in] msg A @ref mongocrypt_binary_t the plaintext BSON value. The viewed data is copied. It is valid to destroy @p msg with @ref mongocrypt_binary_destroy immediately after. @returns A boolean indicating success. If false, an error status is set. Retrieve it with @ref mongocrypt_ctx_status