Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions source/client-side-encryption/client-side-encryption.md
Original file line number Diff line number Diff line change
Expand Up @@ -2523,6 +2523,9 @@ explicit session parameter as described in the [Drivers Sessions Specification](

## Changelog

- 2026-06-16: Update tests in response to server-side validation of payloads
([SERVER-91887](https://jira.mongodb.org/browse/SERVER-91887))

- 2026-05-29: Add stable support for prefix and suffix queries

- Replace `prefixPreview` with `prefix`.
Expand Down
30 changes: 30 additions & 0 deletions source/client-side-encryption/etc/data/encryptedFields-c10.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"fields": [
{
"keyId": {
"$binary": {
"base64": "EjRWeBI0mHYSNBI0VniQEg==",
"subType": "04"
}
},
"path": "encryptedIndexed",
"bsonType": "string",
"queries": {
"queryType": "equality",
"contention": {
"$numberLong": "10"
}
}
},
{
"keyId": {
"$binary": {
"base64": "q83vqxI0mHYSNBI0VniQEg==",
"subType": "04"
}
},
"path": "encryptedUnindexed",
"bsonType": "string"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
"strMaxQueryLength": {
"$numberInt": "10"
},
"contention": {
"$numberLong": "0"
},
"caseSensitive": true,
"diacriticSensitive": true
},
Expand All @@ -29,6 +32,9 @@
"strMaxQueryLength": {
"$numberInt": "10"
},
"contention": {
"$numberLong": "0"
},
"caseSensitive": true,
"diacriticSensitive": true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
"strMaxQueryLength": {
"$numberInt": "10"
},
"contention": {
"$numberLong": "0"
},
"caseSensitive": true,
"diacriticSensitive": true
}
Expand Down
33 changes: 11 additions & 22 deletions source/client-side-encryption/tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1940,6 +1940,13 @@ Read the `"_id"` field of `key1Document` as `key1ID`.
Drop and create the collection `db.explicit_encryption` using `encryptedFields` as an option. See
[FLE 2 CreateCollection() and Collection.Drop()](../client-side-encryption.md#create-collection-helper).

Load the file
[encryptedFields-c10.json](https://github.com/mongodb/specifications/tree/master/source/client-side-encryption/etc/data/encryptedFields-c10.json)
as `encryptedFields_c10`.

Drop and create the collection `db.explicit_encryption_c10` using `encryptedFields_c10` as an option. See
[FLE 2 CreateCollection() and Collection.Drop()](../client-side-encryption.md#create-collection-helper).

Drop and create the collection `keyvault.datakeys`.

Insert `key1Document` in `keyvault.datakeys` with majority write concern.
Expand Down Expand Up @@ -2014,7 +2021,8 @@ class EncryptOpts {

Store the result in `insertPayload`.

Use `encryptedClient` to insert the document `{ "encryptedIndexed": <insertPayload> }` into `db.explicit_encryption`.
Use `encryptedClient` to insert the document `{ "encryptedIndexed": <insertPayload> }` into
`db.explicit_encryption_c10`.

Repeat the above steps 10 times to insert 10 total documents. The `insertPayload` must be regenerated each iteration.

Expand All @@ -2025,34 +2033,15 @@ class EncryptOpts {
keyId : <key1ID>,
algorithm: "Indexed",
queryType: "equality",
contentionFactor: 0,
contentionFactor: 10,
}
```

Store the result in `findPayload`.

Use `encryptedClient` to run a "find" operation on the `db.explicit_encryption` collection with the filter
Use `encryptedClient` to run a "find" operation on the `db.explicit_encryption_c10` collection with the filter
`{ "encryptedIndexed": <findPayload> }`.

Assert less than 10 documents are returned. 0 documents may be returned. Assert each returned document contains the
field `{ "encryptedIndexed": "encrypted indexed value" }`.

Use `clientEncryption` to encrypt the value "encrypted indexed value" with these `EncryptOpts`:

```typescript
class EncryptOpts {
keyId : <key1ID>,
algorithm: "Indexed",
queryType: "equality",
contentionFactor: 10,
}
```

Store the result in `findPayload2`.

Use `encryptedClient` to run a "find" operation on the `db.explicit_encryption` collection with the filter
`{ "encryptedIndexed": <findPayload2> }`.

Assert 10 documents are returned. Assert each returned document contains the field
`{ "encryptedIndexed": "encrypted indexed value" }`.

Expand Down
Loading