Skip to content

Commit 59bb568

Browse files
committed
Merge remote-tracking branch 'kevin/wip-explicit-api' into text-search
2 parents 21ad2cc + 7bacf36 commit 59bb568

File tree

1 file changed

+63
-7
lines changed

1 file changed

+63
-7
lines changed

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

Lines changed: 63 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ 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))
52+
5153
## META
5254

5355
The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and
@@ -1256,6 +1258,7 @@ class EncryptOpts {
12561258
contentionFactor: Optional<Int64>,
12571259
queryType: Optional<String>
12581260
rangeOpts: Optional<RangeOpts>
1261+
textOpts: Optional<TextOpts>
12591262
}
12601263

12611264
// RangeOpts specifies index options for a Queryable Encryption field supporting "range" queries.
@@ -1273,6 +1276,48 @@ class RangeOpts {
12731276
// precision determines the number of significant digits after the decimal point. May only be set for double or decimal128.
12741277
precision: Optional<Int32>
12751278
}
1279+
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+
// substring contains further options to support substring queries.
1284+
substring: Optional<SubstringOpts>,
1285+
// prefix contains further options to support prefix queries.
1286+
prefix: Optional<PrefixOpts>,
1287+
// suffix contains further options to support suffix queries.
1288+
suffix: Optional<SuffixOpts>,
1289+
// caseSensitive determines whether text indexes for this field are case sensitive.
1290+
caseSensitive: bool,
1291+
// diacriticSensitive determines whether text indexes for this field are diacritic sensitive.
1292+
diacriticSensitive: bool
1293+
}
1294+
1295+
// NOTE: SubstringOpts is currently unstable API and subject to backwards breaking changes.
1296+
class SubstringOpts {
1297+
// strMaxLength is the maximum allowed length to insert. Inserting longer strings will error.
1298+
strMaxLength: Int32,
1299+
// strMinQueryLength is the minimum allowed query length. Querying with a shorter string will error.
1300+
strMinQueryLength: Int32,
1301+
// strMaxQueryLength is the maximum allowed query length. Querying with a longer string will error.
1302+
strMaxQueryLength: Int32,
1303+
}
1304+
1305+
// NOTE: PrefixOpts is currently unstable API and subject to backwards breaking changes.
1306+
class PrefixOpts {
1307+
// strMinQueryLength is the minimum allowed query length. Querying with a shorter string will error.
1308+
strMinQueryLength: Int32,
1309+
// strMaxQueryLength is the maximum allowed query length. Querying with a longer string will error.
1310+
strMaxQueryLength: Int32,
1311+
}
1312+
1313+
// NOTE: SuffixOpts is currently unstable API and subject to backwards breaking changes.
1314+
class SuffixOpts {
1315+
// strMinQueryLength is the minimum allowed query length. Querying with a shorter string will error.
1316+
strMinQueryLength: Int32,
1317+
// strMaxQueryLength is the maximum allowed query length. Querying with a longer string will error.
1318+
strMaxQueryLength: Int32,
1319+
}
1320+
12761321
```
12771322
12781323
Explicit encryption requires a key and algorithm. Keys are either identified by `_id` or by alternate name. Exactly one
@@ -1295,34 +1340,43 @@ One of the strings:
12951340
- "Indexed"
12961341
- "Unindexed"
12971342
- "Range"
1343+
- "TextPreview"
12981344
1299-
The result of explicit encryption with the "Indexed" or "Range" algorithm must be processed by the server to insert or
1300-
query. Drivers MUST document the following behavior:
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:
13011347
1302-
> To insert or query with an "Indexed" or "Range" encrypted payload, use a `MongoClient` configured with
1348+
> To insert or query with an "Indexed", "Range", or "TextPreview" encrypted payload, use a `MongoClient` configured with
13031349
> `AutoEncryptionOpts`. `AutoEncryptionOpts.bypassQueryAnalysis` may be true. `AutoEncryptionOpts.bypassAutoEncryption`
13041350
> must be false.
13051351
13061352
#### contentionFactor
13071353
1308-
contentionFactor may be used to tune performance. Only applies when algorithm is "Indexed" or "Range". libmongocrypt
1309-
returns an error if contentionFactor is set for a non-applicable algorithm.
1354+
contentionFactor may be used to tune performance. Only applies when algorithm is "Indexed", "Range", or "TextPreview".
1355+
libmongocrypt returns an error if contentionFactor is set for a non-applicable algorithm.
13101356
13111357
#### queryType
13121358
13131359
One of the strings:
13141360
13151361
- "equality"
13161362
- "range"
1363+
- "prefixPreview"
1364+
- "suffixPreview"
1365+
- "substringPreview"
13171366
1318-
queryType only applies when algorithm is "Indexed" or "Range". libmongocrypt returns an error if queryType is set for a
1319-
non-applicable queryType.
1367+
queryType only applies when algorithm is "Indexed", "Range", or "TextPreview". libmongocrypt returns an error if
1368+
queryType is set for a non-applicable queryType.
13201369
13211370
#### rangeOpts
13221371
13231372
rangeOpts only applies when algorithm is "Range". libmongocrypt returns an error if rangeOpts is set for a
13241373
non-applicable algorithm.
13251374
1375+
#### textOpts
1376+
1377+
textOpts only applies when algorithm is "TextPreview". libmongocrypt returns an error if textOpts is set for a
1378+
non-applicable algorithm.
1379+
13261380
## User facing API: When Auto Encryption Fails
13271381
13281382
Auto encryption requires parsing the MongoDB query language client side (with the [mongocryptd](#mongocryptd) process or
@@ -2463,6 +2517,8 @@ explicit session parameter as described in the [Drivers Sessions Specification](
24632517

24642518
## Changelog
24652519

2520+
- 2025-08-06: Add `TextPreview` algorithm.
2521+
24662522
- 2024-02-19: Add custom options AWS credential provider.
24672523

24682524
- 2024-10-09: Add retry prose test.

0 commit comments

Comments
 (0)