You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clarify manual vs. derived QE setup and add example project link.
Added explanation of when to use manual vs. derived Queryable Encryption configuration.
Included a brief description of each field's encryption and query behavior in the Patient example.
Also added a link to a GitHub project with a complete working example.
Signed-off-by: Ricardo Mello <[email protected]>
Closes#5016
Copy file name to clipboardExpand all lines: src/main/antora/modules/ROOT/pages/mongodb/mongo-encryption.adoc
+30-10Lines changed: 30 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -133,6 +133,11 @@ The information covers the algorithm in use as well as allowed query types along
133
133
`MongoOperations#createCollection(...)` can be used to do the initial setup for collections utilizing QE.
134
134
The configuration for QE via Spring Data uses the same building blocks (a xref:mongodb/mapping/mapping-schema.adoc#mongo.jsonSchema.encrypted-fields[JSON Schema creation]) as CSFLE, converting the schema/properties into the configuration format required by MongoDB.
135
135
136
+
You can configure Queryable Encryption either manually or in a derived way:
137
+
138
+
- Manual setup gives you full control over how encrypted fields are declared and how collections are created. It's useful when you need to explicitly manage data keys, encryption algorithms, and field mappings.
139
+
- Derived setup relies on annotations in your domain model and automatically generates the required encrypted field configuration from it. This is simpler and recommended for typical Spring applications where your data model is already annotated.
<1> Using the template to create the collection may prevent capturing generated keyIds. In this case render the `Document` from the options and use the `createEncryptedCollection(...)` method via the encryption library.
205
+
<1> id and address are not encrypted and can be queried normally.
206
+
<2> pin is encrypted but does not support queries.
207
+
<3> ssn is encrypted and allows equality queries.
208
+
<4> age is encrypted and allows range queries between 0 and 150.
209
+
<5> height is encrypted and allows range queries between 0.3 and 2.5.
192
210
193
211
The `Queryable` annotation allows to define allowed query types for encrypted fields.
194
212
`@RangeEncrypted` is a combination of `@Encrypted` and `@Queryable` for fields allowing `range` queries.
@@ -250,6 +268,8 @@ MongoDB Collection Info::
250
268
- Additional options for eg. `min` and `max` need to match the actual field type. Make sure to use `$numberLong` etc. to ensure target types when parsing bson String.
251
269
- Queryable Encryption will an extra field `__safeContent__` to each of your documents.
252
270
Unless explicitly excluded the field will be loaded into memory when retrieving results.
0 commit comments