diff --git a/source/client-side-encryption/client-side-encryption.md b/source/client-side-encryption/client-side-encryption.md index 79005774ef..437c84360b 100644 --- a/source/client-side-encryption/client-side-encryption.md +++ b/source/client-side-encryption/client-side-encryption.md @@ -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`. diff --git a/source/client-side-encryption/etc/data/encryptedFields-c10.json b/source/client-side-encryption/etc/data/encryptedFields-c10.json new file mode 100644 index 0000000000..e9ed08bb39 --- /dev/null +++ b/source/client-side-encryption/etc/data/encryptedFields-c10.json @@ -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" + } + ] +} diff --git a/source/client-side-encryption/etc/data/encryptedFields-prefix-suffix.json b/source/client-side-encryption/etc/data/encryptedFields-prefix-suffix.json index 141c372dbe..a96e616723 100644 --- a/source/client-side-encryption/etc/data/encryptedFields-prefix-suffix.json +++ b/source/client-side-encryption/etc/data/encryptedFields-prefix-suffix.json @@ -18,6 +18,9 @@ "strMaxQueryLength": { "$numberInt": "10" }, + "contention": { + "$numberLong": "0" + }, "caseSensitive": true, "diacriticSensitive": true }, @@ -29,6 +32,9 @@ "strMaxQueryLength": { "$numberInt": "10" }, + "contention": { + "$numberLong": "0" + }, "caseSensitive": true, "diacriticSensitive": true } diff --git a/source/client-side-encryption/etc/data/encryptedFields-substring.json b/source/client-side-encryption/etc/data/encryptedFields-substring.json index ee22def77b..d321a32c5c 100644 --- a/source/client-side-encryption/etc/data/encryptedFields-substring.json +++ b/source/client-side-encryption/etc/data/encryptedFields-substring.json @@ -21,6 +21,9 @@ "strMaxQueryLength": { "$numberInt": "10" }, + "contention": { + "$numberLong": "0" + }, "caseSensitive": true, "diacriticSensitive": true } diff --git a/source/client-side-encryption/tests/README.md b/source/client-side-encryption/tests/README.md index 8598833523..7fcc963b2f 100644 --- a/source/client-side-encryption/tests/README.md +++ b/source/client-side-encryption/tests/README.md @@ -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. @@ -2014,7 +2021,8 @@ class EncryptOpts { Store the result in `insertPayload`. -Use `encryptedClient` to insert the document `{ "encryptedIndexed": }` into `db.explicit_encryption`. +Use `encryptedClient` to insert the document `{ "encryptedIndexed": }` into +`db.explicit_encryption_c10`. Repeat the above steps 10 times to insert 10 total documents. The `insertPayload` must be regenerated each iteration. @@ -2025,34 +2033,15 @@ class EncryptOpts { keyId : , 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": }`. -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 : , - 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": }`. - Assert 10 documents are returned. Assert each returned document contains the field `{ "encryptedIndexed": "encrypted indexed value" }`.