Skip to content

Commit f2b2478

Browse files
committed
format
1 parent 0ffe96c commit f2b2478

File tree

3 files changed

+40
-38
lines changed

3 files changed

+40
-38
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"subType": "04"
88
}
99
},
10-
"path": "encrypted-textPreview",
10+
"path": "encryptedText",
1111
"bsonType": "string",
1212
"queries": [
1313
{

source/client-side-encryption/etc/data/encryptedFields-substring.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"subType": "04"
88
}
99
},
10-
"path": "encrypted-textPreview",
10+
"path": "encryptedText",
1111
"bsonType": "string",
1212
"queries": [
1313
{

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

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3834,6 +3834,36 @@ class EncryptOpts {
38343834
}
38353835
```
38363836

3837+
Where prefix, suffix, or substring options are required, use the following:
3838+
3839+
1. Prefix
3840+
3841+
```typescript
3842+
class PrefixOpts {
3843+
strMaxQueryLength: 10,
3844+
strMinQueryLength: 2,
3845+
}
3846+
```
3847+
3848+
2. Suffix
3849+
3850+
```typescript
3851+
class SuffixOpts {
3852+
strMaxQueryLength: 10,
3853+
strMinQueryLength: 2,
3854+
}
3855+
```
3856+
3857+
3. Substring
3858+
3859+
```typescript
3860+
class SubstringOpts {
3861+
strMaxLength: 10,
3862+
strMaxQueryLength: 10,
3863+
strMinQueryLength: 2,
3864+
}
3865+
```
3866+
38373867
Use `encryptedClient` to insert the following document into `db.prefix-suffix`:
38383868

38393869
```javascript
@@ -3885,42 +3915,14 @@ class EncryptOpts {
38853915
}
38863916
```
38873917

3888-
1. Prefix
3889-
3890-
```typescript
3891-
class PrefixOpts {
3892-
strMaxQueryLength: 10,
3893-
strMinQueryLength: 2,
3894-
}
3895-
```
3896-
3897-
2. Suffix
3898-
3899-
```typescript
3900-
class SuffixOpts {
3901-
strMaxQueryLength: 10,
3902-
strMinQueryLength: 2,
3903-
}
3904-
```
3905-
3906-
3. Substring
3907-
3908-
```typescript
3909-
class SubstringOpts {
3910-
strMaxLength: 10,
3911-
strMaxQueryLength: 10,
3912-
strMinQueryLength: 2,
3913-
}
3914-
```
3915-
39163918
#### Case 1: can find a document by prefix
39173919

39183920
Use `clientEncryption.encrypt()` to encrypt the string `"foo"`. Store the resulting payload in `findPayload`.
39193921

39203922
Use `encryptedClient` to run a "find" operation on the `db.prefix-suffix` collection with the following filter:
39213923

39223924
```javascript
3923-
{ "$expr": { "$encStrStartsWith": {"input": "$encryptedText", "prefix": <findPayload>}, } }
3925+
{ $expr: { $encStrStartsWith: {input: '$encryptedText', prefix: <findPayload>}, } }
39243926
```
39253927

39263928
Assert the following document is returned:
@@ -3931,12 +3933,12 @@ Assert the following document is returned:
39313933

39323934
#### Case 2: can find a document by suffix
39333935

3934-
Use `clientEncryption.encrypt()` to encrypt the string `"foo"`. Store the resulting payload in `findPayload`.
3936+
Use `clientEncryption.encrypt()` to encrypt the string `"baz"`. Store the resulting payload in `findPayload`.
39353937

39363938
Use `encryptedClient` to run a "find" operation on the `db.prefix-suffix` collection with the following filter:
39373939

39383940
```javascript
3939-
{ "$expr": { "$encStrStartsWith": {"input": "$encryptedText", "prefix": <findPayload>}, } }
3941+
{ $expr: { $encStrEndsWith: {input: '$encryptedText', suffix: <findPayload>}, } }
39403942
```
39413943

39423944
Assert the following document is returned:
@@ -3947,12 +3949,12 @@ Assert the following document is returned:
39473949

39483950
#### Case 3: assert no document found by prefix
39493951

3950-
Use `clientEncryption.encrypt()` to encrypt the string `"foo"`. Store the resulting payload in `findPayload`.
3952+
Use `clientEncryption.encrypt()` to encrypt the string `"baz"`. Store the resulting payload in `findPayload`.
39513953

39523954
Use `encryptedClient` to run a "find" operation on the `db.prefix-suffix` collection with the following filter:
39533955

39543956
```javascript
3955-
{ "$expr": { "$encStrStartsWith": {"input": "$encryptedText", "prefix": <findPayload>}, } }
3957+
{ $expr: { $encStrStartsWith: {input: '$encryptedText', prefix: <findPayload>}, } }
39563958
```
39573959

39583960
Assert that no documents are returned.
@@ -3964,7 +3966,7 @@ Use `clientEncryption.encrypt()` to encrypt the string `"foo"`. Store the result
39643966
Use `encryptedClient` to run a "find" operation on the `db.prefix-suffix` collection with the following filter:
39653967

39663968
```javascript
3967-
{ "$expr": { "$encStrStartsWith": {"input": "$encryptedText", "suffix": <findPayload>}, } }
3969+
{ $expr: { $encStrEndsWith: {input: '$encryptedText', suffix: <findPayload>}, } }
39683970
```
39693971

39703972
Assert that no documents are returned.
@@ -3976,7 +3978,7 @@ Use `clientEncryption.encrypt()` to encrypt the string `"foo"`. Store the result
39763978
Use `encryptedClient` to run a "find" operation on the `db.substring` collection with the following filter:
39773979

39783980
```javascript
3979-
{ "$expr": { "$encStrStartsWith": {"input": "$encryptedText", "prefix": <findPayload>}, } }
3981+
{ $expr: { $encStrContains: {input: '$encryptedText', substring: <findPayload>}, } }
39803982
```
39813983

39823984
Assert the following document is returned:
@@ -3992,7 +3994,7 @@ Use `clientEncryption.encrypt()` to encrypt the string `"qux"`. Store the result
39923994
Use `encryptedClient` to run a "find" operation on the `db.substring` collection with the following filter:
39933995

39943996
```javascript
3995-
{ "$expr": { "$encStrStartsWith": {"input": "$encryptedText", "prefix": <findPayload>}, } }
3997+
{ $expr: { $encStrContains: {input: '$encryptedText', substring: <findPayload>}, } }
39963998
```
39973999

39984000
Assert that no documents are returned.

0 commit comments

Comments
 (0)