Skip to content

Commit c9b3ee0

Browse files
authored
DRIVERS-3321 update QE for prefix and suffix (#1945)
1 parent c593b9e commit c9b3ee0

12 files changed

Lines changed: 123 additions & 123 deletions

source/client-side-encryption/client-side-encryption.md

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ QEv1 and QEv2 are incompatible.
4848
MongoDB 8.0 dropped `queryType=rangePreview` and added `queryType=range`
4949
([SPM-3583](https://jira.mongodb.org/browse/SPM-3583)).
5050

51-
MongoDB 8.2 added unstable support for QE text queries ([SPM-2880](https://jira.mongodb.org/browse/SPM-2880))
51+
MongoDB 8.2 added unstable support for QE string queries ([SPM-2880](https://jira.mongodb.org/browse/SPM-2880))
52+
53+
MongoDB 9.0 dropped `queryType=prefixPreview|suffixPreview` and added `queryType=prefix|suffix`
54+
([SPM-4539](https://jira.mongodb.org/browse/SPM-4539))
5255

5356
## META
5457

@@ -1258,7 +1261,7 @@ class EncryptOpts {
12581261
contentionFactor: Optional<Int64>,
12591262
queryType: Optional<String>
12601263
rangeOpts: Optional<RangeOpts>
1261-
textOpts: Optional<TextOpts>
1264+
stringOpts: Optional<StringOpts>
12621265
}
12631266

12641267
// RangeOpts specifies index options for a Queryable Encryption field supporting "range" queries.
@@ -1277,18 +1280,18 @@ class RangeOpts {
12771280
precision: Optional<Int32>
12781281
}
12791282

1280-
// TextOpts specifies options for a Queryable Encryption field supporting text queries.
1281-
// NOTE: TextOpts is currently unstable API and subject to backwards breaking changes.
1282-
class TextOpts {
1283+
// StringOpts specifies options for a Queryable Encryption field supporting string queries.
1284+
class StringOpts {
12831285
// substring contains further options to support substring queries.
1286+
// NOTE: substring is currently unstable API and subject to backwards breaking changes.
12841287
substring: Optional<SubstringOpts>,
12851288
// prefix contains further options to support prefix queries.
12861289
prefix: Optional<PrefixOpts>,
12871290
// suffix contains further options to support suffix queries.
12881291
suffix: Optional<SuffixOpts>,
1289-
// caseSensitive determines whether text indexes for this field are case sensitive.
1292+
// caseSensitive determines whether string indexes for this field are case sensitive.
12901293
caseSensitive: bool,
1291-
// diacriticSensitive determines whether text indexes for this field are diacritic sensitive.
1294+
// diacriticSensitive determines whether string indexes for this field are diacritic sensitive.
12921295
diacriticSensitive: bool
12931296
}
12941297

@@ -1302,15 +1305,13 @@ class SubstringOpts {
13021305
strMaxQueryLength: Int32,
13031306
}
13041307

1305-
// NOTE: PrefixOpts is currently unstable API and subject to backwards breaking changes.
13061308
class PrefixOpts {
13071309
// strMinQueryLength is the minimum allowed query length. Querying with a shorter string will error.
13081310
strMinQueryLength: Int32,
13091311
// strMaxQueryLength is the maximum allowed query length. Querying with a longer string will error.
13101312
strMaxQueryLength: Int32,
13111313
}
13121314

1313-
// NOTE: SuffixOpts is currently unstable API and subject to backwards breaking changes.
13141315
class SuffixOpts {
13151316
// strMinQueryLength is the minimum allowed query length. Querying with a shorter string will error.
13161317
strMinQueryLength: Int32,
@@ -1340,20 +1341,20 @@ One of the strings:
13401341
- "Indexed"
13411342
- "Unindexed"
13421343
- "Range"
1343-
- "TextPreview"
1344+
- "String"
13441345
1345-
The result of explicit encryption with the "Indexed", "Range", or "TextPreview" algorithm must be processed by the
1346-
server to insert or query. Drivers MUST document the following behavior:
1346+
The result of explicit encryption with the "Indexed", "Range", or "String" algorithm must be processed by the server to
1347+
insert or query. Drivers MUST document the following behavior:
13471348
1348-
> To insert or query with an "Indexed", "Range", or "TextPreview" encrypted payload, use a `MongoClient` configured with
1349+
> To insert or query with an "Indexed", "Range", or "String" encrypted payload, use a `MongoClient` configured with
13491350
> `AutoEncryptionOpts`. `AutoEncryptionOpts.bypassQueryAnalysis` may be true. `AutoEncryptionOpts.bypassAutoEncryption`
1350-
> must be false. The "TextPreview" algorithm is in preview and should be used for experimental workloads only. These
1351-
> features are unstable and their security is not guaranteed until released as Generally Available (GA). The GA version
1352-
> of these features may not be backwards compatible with the preview version.
1351+
> must be false. The "substringPreview" query type is in preview and should be used for experimental workloads only.
1352+
> This feature is unstable and its security is not guaranteed until released as Generally Available (GA). The GA version
1353+
> of this feature may not be backwards compatible with the preview version.
13531354
13541355
#### contentionFactor
13551356
1356-
contentionFactor may be used to tune performance. Only applies when algorithm is "Indexed", "Range", or "TextPreview".
1357+
contentionFactor may be used to tune performance. Only applies when algorithm is "Indexed", "Range", or "String".
13571358
libmongocrypt returns an error if contentionFactor is set for a non-applicable algorithm.
13581359
13591360
#### queryType
@@ -1362,24 +1363,24 @@ One of the strings:
13621363
13631364
- "equality"
13641365
- "range"
1365-
- "prefixPreview"
1366+
- "prefix"
13661367
- Used for the `$encStrStartsWith` operator.
1367-
- "suffixPreview"
1368+
- "suffix"
13681369
- Used for the `$encStrEndsWith` operator.
13691370
- "substringPreview"
13701371
- Used for the `$encStrContains` operator.
13711372
1372-
queryType only applies when algorithm is "Indexed", "Range", or "TextPreview". libmongocrypt returns an error if
1373-
queryType is set for a non-applicable algorithm.
1373+
queryType only applies when algorithm is "Indexed", "Range", or "String". libmongocrypt returns an error if queryType is
1374+
set for a non-applicable algorithm.
13741375
13751376
#### rangeOpts
13761377
13771378
rangeOpts only applies when algorithm is "Range". libmongocrypt returns an error if rangeOpts is set for a
13781379
non-applicable algorithm.
13791380
1380-
#### textOpts
1381+
#### stringOpts
13811382
1382-
textOpts only applies when algorithm is "TextPreview". libmongocrypt returns an error if textOpts is set for a
1383+
stringOpts only applies when algorithm is "String". libmongocrypt returns an error if stringOpts is set for a
13831384
non-applicable algorithm.
13841385
13851386
## User facing API: When Auto Encryption Fails
@@ -2522,6 +2523,13 @@ explicit session parameter as described in the [Drivers Sessions Specification](
25222523

25232524
## Changelog
25242525

2526+
- 2026-05-29: Add stable support for prefix and suffix queries
2527+
2528+
- Replace `prefixPreview` with `prefix`.
2529+
- Replace `suffixPreview` with `suffix`.
2530+
- Replace `TextPreview` with `String`.
2531+
- Replace `TextOpts` with `StringOpts`.
2532+
25252533
- 2025-09-30: Update `$lookup` prose test to reflect changes in
25262534
[MONGOCRYPT-793](https://jira.mongodb.org/browse/MONGOCRYPT-793).
25272535

source/client-side-encryption/etc/data/encryptedFields-prefix-suffix-ci-di.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"bsonType": "string",
1212
"queries": [
1313
{
14-
"queryType": "prefixPreview",
14+
"queryType": "prefix",
1515
"strMinQueryLength": {
1616
"$numberInt": "2"
1717
},
@@ -23,7 +23,7 @@
2323
"diacriticSensitive": false
2424
},
2525
{
26-
"queryType": "suffixPreview",
26+
"queryType": "suffix",
2727
"strMinQueryLength": {
2828
"$numberInt": "2"
2929
},

source/client-side-encryption/etc/data/encryptedFields-prefix-suffix.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"fields": [
3-
{
2+
"fields": [
3+
{
44
"keyId": {
55
"$binary": {
66
"base64": "EjRWeBI0mHYSNBI0VniQEg==",
@@ -11,7 +11,7 @@
1111
"bsonType": "string",
1212
"queries": [
1313
{
14-
"queryType": "prefixPreview",
14+
"queryType": "prefix",
1515
"strMinQueryLength": {
1616
"$numberInt": "2"
1717
},
@@ -22,7 +22,7 @@
2222
"diacriticSensitive": true
2323
},
2424
{
25-
"queryType": "suffixPreview",
25+
"queryType": "suffix",
2626
"strMinQueryLength": {
2727
"$numberInt": "2"
2828
},
@@ -34,5 +34,5 @@
3434
}
3535
]
3636
}
37-
]
37+
]
3838
}

0 commit comments

Comments
 (0)