[DRIVERS-2352] EncryptOpts queryType should accept a string consistent with queryType in encryptedFields Created: 09/Jun/22  Updated: 17/Jun/22

Status: Implementing
Project: Drivers
Component/s: Client Side Encryption
Fix Version/s: None

Type: Spec Change Priority: Unknown
Reporter: Jeremy Mikola Assignee: Kevin Albertson
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on MONGOCRYPT-441 Accept string values for QueryType an... Closed
Issue split
split to PHPC-2104 EncryptOpts queryType should accept a... Closed
split to CXX-2525 EncryptOpts queryType should accept a... Backlog
split to CDRIVER-4404 EncryptOpts queryType should accept a... Closed
split to CSHARP-4204 EncryptOpts queryType should accept a... Closed
split to GODRIVER-2454 EncryptOpts queryType should accept a... Closed
split to JAVA-4643 EncryptOpts queryType should accept a... Closed
split to MOTOR-976 EncryptOpts queryType should accept a... Closed
split to NODE-4303 EncryptOpts queryType should accept a... Closed
split to PYTHON-3301 EncryptOpts queryType should accept a... Closed
split to RUBY-3024 EncryptOpts queryType should accept a... Closed
split to RUST-1361 EncryptOpts queryType should accept a... Closed
Driver Changes: Needed
Downstream Changes Summary:

Bindings Changes

Upgrade to libmongocrypt 1.5.0-rc2. Binaries can be downloaded from the upload-all task.

Bindings in the libmongocrypt repository were updated in MONGOCRYPT-414. Drivers with bindings outside of the libmongocrypt repo will need to update bindings code.

Replace calls of mongocrypt_ctx_setopt_index_type with mongocrypt_ctx_setopt_algorithm.

Update calls of mongocrypt_ctx_setopt_query_type to use the string "equality".

Driver Changes

Change EncryptOpts.QueryType from an enum to a string. See the specification change here: https://github.com/mongodb/specifications/commit/cb58ded938146fcbce2b04a91d09f72d66832603.

See the C driver changes for reference: https://github.com/mongodb/mongo-c-driver/commit/fe2bae72bc733515d766a46a8799783667396590

Driver Compliance:
Key Status/Resolution FixVersion
CDRIVER-4404 Done
CXX-2525 Backlog
CSHARP-4204 Duplicate
GODRIVER-2454 Fixed 1.10.0
JAVA-4643 Done
NODE-4303 Done mongodb-client-encryption-2.2.0
MOTOR-976 Duplicate
PYTHON-3301 Duplicate
PHPC-2104 Fixed 1.14.0
RUBY-3024 Fixed 2.18.0
RUST-1361 Duplicate
SWIFT-1581 Duplicate

 Description   

Summary

EncryptOpts currently defines the queryType option as an enum. Drivers should change the option to accept a string value, which would more easily allow for forward compatibility (a libmongocrypt version bump would likely be required, but drivers would not necessarily need to be changed).

This would be similar to what is done for Read Concern level, where drivers provide an enum but also accept string values for forward compatibility.

This would depend on MONGOCRYPT-441, which would change libmongocrypt to accept a string value.

Ideally, the string value accepted for queryType should be consistent with the queryType option accepted by the server in an encryptedFields document. Then, users could utilize the same constant defined by drivers for use with EncryptOpts.

Motivation

Who is the affected end user?

Users of queryable encryption.

How does this affect the end user?

Making the string consistent between encryptedFields and EncryptOpts would be a boon for users.

How likely is it that this problem or use case will occur?

Users may be confused if encryptedFields and EncryptOpts accept different values for the queryType option.

If the problem does occur, what are the consequences and how severe are they?

Immediate error message for an invalid option.

Is this issue urgent?

Ideally before 6.0-compat stable driver releases.

Is this ticket required by a downstream team?

May be relevant to mongosh.

Is this ticket only for tests?

No.



 Comments   
Comment by Githook User [ 17/Jun/22 ]

Author:

{'name': 'Kevin Albertson', 'email': 'kevin.albertson@mongodb.com', 'username': 'kevinAlbs'}

Message: DRIVERS-2352 use a string for QueryType (#1252)
Branch: master
https://github.com/mongodb/specifications/commit/cb58ded938146fcbce2b04a91d09f72d66832603

Generated at Thu Feb 08 08:25:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.