Adding queryable encryption range support#4885
Adding queryable encryption range support#4885rozza wants to merge 3 commits intospring-projects:mainfrom
Conversation
Supports range style queries for encrypted fields
| * | ||
| * @param encryptedFields can be null | ||
| * @return new instance of {@link CollectionOptions}. | ||
| * @since 4.5.0 |
There was a problem hiding this comment.
Not sure if this is the correct version?
| * @param options | ||
| * @return | ||
| */ | ||
| public static RangeOptionsAdapter rangeOptionsAdapter(RangeOptions options) { |
There was a problem hiding this comment.
Only available in the 5.x driver
| database.getCollection("test").drop(); | ||
|
|
||
| ClientEncryption clientEncryption = mongoClientEncryption.getClientEncryption(); | ||
| BsonDocument encryptedFields = new BsonDocument().append("fields", |
There was a problem hiding this comment.
Added multiple fields as:
a) its non trivial / not obvious how to do so.
b) needed to ensure testing worked as expected
|
|
||
| private static final String LOCAL_KMS_PROVIDER = "local"; | ||
|
|
||
| private static final Lazy<Map<String, Map<String, Object>>> LAZY_KMS_PROVIDERS = Lazy.of(() -> { |
There was a problem hiding this comment.
Lazily constructed the master key - so does this only once.
| builder.autoEncryptionSettings(AutoEncryptionSettings.builder() // | ||
| .kmsProviders(clientEncryptionSettings.getKmsProviders()) // | ||
| .keyVaultNamespace(clientEncryptionSettings.getKeyVaultNamespace()) // | ||
| .bypassQueryAnalysis(true).build()); |
There was a problem hiding this comment.
bypassQueryAnalysis is required to be true.
|
@christophstrobl apologies I closed #4879 while I was still working through it and couldn't reopen it - so created a new PR. |
| Assert.isInstanceOf(Integer.class, trimFactor, () -> String | ||
| .format("Expected to find a %s but it turned out to be %s.", Integer.class, trimFactor.getClass())); | ||
|
|
||
| rangeOptionsAdapter(encryptionRangeOptions).trimFactor((Integer) trimFactor); |
There was a problem hiding this comment.
Not sure what the best approach is for handling Mongo driver 4 user. This adapter is needed to compile - but should there be another check to prevent them using range options at all?
There was a problem hiding this comment.
we're going to remove the 4.x driver backwards compatibility for the next release, so don't worry about that one.
There was a problem hiding this comment.
No problems - have removed.
|
Note: The Also I haven't added |
This commit decouples queryable encryption from explicit encryption and introduces the Queryable annotation to represent different query types like range and equality. Additionally it removes value conversion from range encryption and fixes update mapping of range encrypted fields. Original Pull Request: #4885
Original Pull Request: #4885
Original Pull Request: #4885
|
Thank you @rozza - merged to 4.5 development line. |
Guard tests for encryption functionality. Original Pull Request: #4885
Guard tests for encryption functionality. Original Pull Request: #4885
This commit decouples queryable encryption from explicit encryption and introduces the Queryable annotation to represent different query types like range and equality. Additionally it removes value conversion from range encryption and fixes update mapping of range encrypted fields. Original Pull Request: #4885
Original Pull Request: #4885
Original Pull Request: #4885
Guard tests for encryption functionality. Original Pull Request: #4885
This commit decouples queryable encryption from explicit encryption and introduces the Queryable annotation to represent different query types like range and equality. Additionally it removes value conversion from range encryption and fixes update mapping of range encrypted fields. Original Pull Request: #4885
Original Pull Request: #4885
Original Pull Request: #4885
Guard tests for encryption functionality. Original Pull Request: #4885
Supports range style queries for encrypted fields.
Note: This feature requires MongoDB 8.0 and a Mongo Client 5.x
Closes: #4185