Skip to content

Commit d41d48b

Browse files
authored
DRIVERS-3294 Update $lookup prose test to support 8.2+ (#1846)
1 parent f3a5702 commit d41d48b

File tree

3 files changed

+40
-2
lines changed

3 files changed

+40
-2
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2519,6 +2519,9 @@ explicit session parameter as described in the [Drivers Sessions Specification](
25192519

25202520
## Changelog
25212521

2522+
- 2025-09-30: Update `$lookup` prose test to reflect changes in
2523+
[MONGOCRYPT-793](https://jira.mongodb.org/browse/MONGOCRYPT-793).
2524+
25222525
- 2025-08-06: Add `TextPreview` algorithm.
25232526

25242527
- 2024-02-19: Add custom options AWS credential provider.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"bsonType": "object"
3+
}

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

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3457,6 +3457,7 @@ Use `encryptedClient` to drop and create the following collections:
34573457
- `db.qe2` with options: `{ "encryptedFields": "<schema-qe2.json>"}`.
34583458
- `db.no_schema` with no options.
34593459
- `db.no_schema2` with no options.
3460+
- `db.non_csfle_schema` with options: `{ "validator": { "$jsonSchema": "<schema-non-csfle.json>"}}`
34603461

34613462
Create an unencrypted MongoClient named `unencryptedClient`.
34623463

@@ -3472,6 +3473,7 @@ Insert documents with `encryptedClient`:
34723473
- Use `unencryptedClient` to retrieve it. Assert the `qe2` field is BSON binary.
34733474
- `{"no_schema": "no_schema"}` into `db.no_schema`
34743475
- `{"no_schema2": "no_schema2"}` into `db.no_schema2`
3476+
- `{"non_csfle_schema": "non_csfle_schema"}` into `db.non_csfle_schema`
34753477

34763478
#### Case 1: `db.csfle` joins `db.no_schema`
34773479

@@ -3652,7 +3654,7 @@ Expect one document to be returned matching:
36523654

36533655
#### Case 8: `db.csfle` joins `db.qe`
36543656

3655-
Test requires server 8.1+ and mongocryptd/crypt_shared 8.1+.
3657+
Test requires server 8.1+ and mongocryptd/crypt_shared 8.1+
36563658

36573659
Recreate `encryptedClient` with the same `AutoEncryptionOpts` as the setup. (Recreating prevents schema caching from
36583660
impacting the test).
@@ -3673,7 +3675,12 @@ Run an aggregate operation on `db.csfle` with the following pipeline:
36733675
]
36743676
```
36753677

3676-
Expect an exception to be thrown with a message containing the substring `not supported`.
3678+
Expect an exception to be thrown with a message containing one of the following substrings depending on the
3679+
mongocryptd/crypt_shared and libmongocrypt versions:
3680+
3681+
- mongocryptd/crypt_shared \<8.2 **or** libmongocrypt \<1.17.0: `not supported`.
3682+
- mongocryptd/crypt_shared 8.2+ **and** libmongocrypt 1.17.0+:
3683+
`Cannot specify both encryptionInformation and csfleEncryptionSchemas unless csfleEncryptionSchemas only contains non-encryption JSON schema validators`.
36773684

36783685
#### Case 9: test error with \<8.1
36793686

@@ -3700,6 +3707,31 @@ Run an aggregate operation on `db.csfle` with the following pipeline:
37003707

37013708
Expect an exception to be thrown with a message containing the substring `Upgrade`.
37023709

3710+
#### Case 10: `db.qe` joins `db.non_csfle_schema`
3711+
3712+
Test requires server 8.2+, mongocryptd/crypt_shared 8.2+, and libmongocrypt 1.17.0+.
3713+
3714+
Recreate `encryptedClient` with the same `AutoEncryptionOpts` as the setup. (Recreating prevents schema caching from
3715+
impacting the test).
3716+
3717+
Run an aggregate operation on `db.qe` with the following pipeline:
3718+
3719+
```json
3720+
[
3721+
{"$match" : {"qe" : "qe"}},
3722+
{
3723+
"$lookup" : {
3724+
"from" : "non_csfle_schema",
3725+
"as" : "matched",
3726+
"pipeline" : [ {"$match" : {"non_csfle_schema" : "non_csfle_schema"}}, {"$project" : {"_id" : 0, "__safeContent__" : 0}} ]
3727+
}
3728+
},
3729+
{"$project" : {"_id" : 0, "__safeContent__" : 0}}
3730+
]
3731+
```
3732+
3733+
Expect one document to be returned matching: `{"qe" : "qe", "matched" : [ {"non_csfle_schema" : "non_csfle_schema"} ]}`.
3734+
37033735
### 26. Custom AWS Credentials
37043736

37053737
These tests require valid AWS credentials for the remote KMS provider via the secrets manager (FLE_AWS_KEY and

0 commit comments

Comments
 (0)