Uploaded image for project: 'Libmongocrypt'
  1. Libmongocrypt
  2. MONGOCRYPT-505

Add context initializer for encryptExpression

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 1.7.0, 1.7.0-alpha1
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      Summary

      • Add a new context initializer to support ClientEncryption.encryptExpression().
        • Require queryType to be "rangePreview"
      • Error if queryType "rangePreview" is passed to the context for ClientEncryption.Encrypt().

      Background & Motivation

      The DBX Scope: Driver Support for Range Index currently proposes this API:

         // encryptExpression encrypts an expression to query a range index.
         // `expr` is expected to be a BSON document of one of the following forms:
         // 1. A Match Expression of this form:
         //   {$and: [{<field>: {$gt: <value1>}}, {<field>: {$lt: <value2> }}]}
         // 2. An Aggregate Expression of this form:
         //   {$and: [{$gt: [<fieldpath>, <value1>]}, {$lt: [<fieldpath>, <value2>]}]
         // $gt may also be $gte. $lt may also be $lte.
         // Only supported for queryType "rangePreview"
         encryptExpression(expr: BsonDocument, opts: EncryptOpts): BsonDocument;
      

      ClientEncryption.Encrypt() uses mongocrypt_ctx_explicit_encrypt_init.

      mongocrypt_ctx_explicit_encrypt_init currently supports encrypting the Match Expression or Aggregate Expression, and returns a BSON document.

      A separate initializer (perhaps named mongocrypt_ctx_explicit_encrypt_expression_init) can mirror the driver API. It can check for the required queryType=rangePreview.

            Assignee:
            kevin.albertson@mongodb.com Kevin Albertson
            Reporter:
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: