Closed
Description
Hi team,
While testing out the CollectionOptions.encryptedCollection feature in Spring Data MongoDB version 4.5.0 with Queryable Encryption, I noticed that currently, it seems I can only encrypt fields that are also marked as queryable. However, in some use cases, I’d like to have fields that are encrypted but not queryable.
For example, I’d like to do something like this:
CollectionOptions collectionOptions = CollectionOptions.encryptedCollection(options -> options
.encrypted(encrypted(string("name")).keyId(dkName.asUuid())) // encrypted but not queryable
.queryable(encrypted(int32("age")).algorithm("Range").keyId(dkAge.asUuid()), range().contention(0).min(0).max(130)) // encrypted and queryable
);
This would allow me to encrypt the "name" field without making it queryable, while still taking advantage of range queries on "age". As of now, the API doesn’t seem to support this scenario.
Let me know if you need anything.
Thanks in advance.