-
Type: Task
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
-
Not Needed
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.