RUBY-3611 Support $lookup in CSFLE/QE#3054
Open
jamis wants to merge 15 commits into
Open
Conversation
…h_db state, and ctx_mongo_db
…go_collinfo_with_db state
…plication" message cropping up again
…`before(:all)` block
the error message recommends this approach
Contributor
There was a problem hiding this comment.
Pull request overview
Adds driver + test support for running CSFLE/QE aggregation pipelines that include $lookup, which requires libmongocrypt to handle multiple collection schemas and (for some operations) to request collection info for a specific database.
Changes:
- Enable/handle new libmongocrypt capabilities: multiple-collection collinfo, and the
need_mongo_collinfo_with_dbcontext state. - Update encryption I/O to return all matching collection info documents (not just the first) and feed each to libmongocrypt.
- Add a new prose integration spec and supporting schema/key fixtures to validate
$lookupbehavior across CSFLE/QE/plain collections.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/support/spec_config.rb | Grants test user privileges for the new collection_info_test database used by specs. |
| spec/support/crypt.rb | Extracts shared extra_options builder into Crypt.extra_options and reuses it in shared FLE helpers. |
| spec/support/crypt/lookup/schema-qe2.json | Adds QE2 encryptedFields fixture for $lookup prose test. |
| spec/support/crypt/lookup/schema-qe.json | Adds QE encryptedFields fixture for $lookup prose test. |
| spec/support/crypt/lookup/schema-non-csfle.json | Adds non-CSFLE JSON schema fixture for prose test case 10. |
| spec/support/crypt/lookup/schema-csfle2.json | Adds CSFLE2 JSON schema fixture for prose test. |
| spec/support/crypt/lookup/schema-csfle.json | Adds CSFLE JSON schema fixture for prose test. |
| spec/support/crypt/lookup/key-doc.json | Adds data key fixture used by the $lookup prose test. |
| spec/mongo/crypt/handle_spec.rb | Verifies the handle enables new libmongocrypt options. |
| spec/mongo/crypt/encryption_io_spec.rb | Adds unit coverage ensuring collection_info returns arrays correctly. |
| spec/mongo/crypt/binding/mongocrypt_spec.rb | Adds unit coverage for new binding option setters. |
| spec/mongo/crypt/binding/context_spec.rb | Adds coverage for the new context-state enum value. |
| spec/integration/client_side_encryption/lookup_prose_spec.rb | New prose integration spec validating $lookup behavior for CSFLE and QE. |
| lib/mongo/crypt/handle.rb | Enables multiple collinfo and “collinfo-with-db” state handling on handle initialization. |
| lib/mongo/crypt/encryption_io.rb | Changes collection_info to return all matching collection info documents. |
| lib/mongo/crypt/context.rb | Adds support for the new :need_mongo_collinfo_with_db state and feeds multiple collinfo docs. |
| lib/mongo/crypt/binding.rb | Extends ctx-state enum and binds new libmongocrypt APIs for $lookup support. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for
$lookupwith CSFLE and QE.