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
Copy file name to clipboardExpand all lines: src/main/antora/modules/ROOT/pages/mongodb/mongo-encryption.adoc
+34-14Lines changed: 34 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -135,8 +135,26 @@ The configuration for QE via Spring Data uses the same building blocks (a xref:m
135
135
136
136
You can configure Queryable Encryption either manually or in a derived way:
137
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.
138
+
**Manual setup**
139
+
140
+
Manual setup gives you full control over how encrypted fields are declared and how collections are created.
141
+
It's useful when you need to explicitly manage data keys, encryption algorithms, and field mappings.
142
+
143
+
** ✅ Full control over encryption configuration
144
+
** ✅ Explicitly manage data keys and algorithms
145
+
** ✅ Allows for complex encryption scenarios
146
+
** ✅ Explicit configuration avoids the risk of surprises (e.g. missing configuration because of improper annotations or class-path scanning)
147
+
** ⚠️ An Explicit Field Configuration can diverge from the domain model and you must keep it in sync with the domain model
148
+
149
+
**Derived setup*
150
+
151
+
Derived setup relies on annotations in your domain model and automatically generates the required encrypted field configuration from it.
152
+
This is simpler and recommended for typical Spring applications where your data model is already annotated.
153
+
154
+
** ✅ Domain model-driven configuration
155
+
** ✅ Easy to set up and maintain
156
+
** ⚠️ Might not cover all complex scenarios
157
+
** ⚠️ Risk of surprises (e.g. missing configuration for documents based on subtypes because of improper annotations or class-path scanning)
.encryptedFields(encryptedFields), new CreateEncryptedCollectionParams("local"))); <1>
203
221
204
222
----
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.
223
+
224
+
<1> `id` and `address` are not encrypted.
225
+
Those fields can be queried normally.
226
+
<2> `pin` is encrypted but does not support queries.
227
+
<3> `ssn` is encrypted and allows equality queries.
228
+
<4> `age` is encrypted and allows range queries between `0` and `150`.
229
+
<5> `height` is encrypted and allows range queries between `0.3` and `2.5`.
210
230
211
231
The `Queryable` annotation allows to define allowed query types for encrypted fields.
212
232
`@RangeEncrypted` is a combination of `@Encrypted` and `@Queryable` for fields allowing `range` queries.
@@ -268,7 +288,7 @@ MongoDB Collection Info::
268
288
- 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.
269
289
- Queryable Encryption will an extra field `__safeContent__` to each of your documents.
270
290
Unless explicitly excluded the field will be loaded into memory when retrieving results.
0 commit comments