-
Type: Bug
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: 1.25.0
-
Component/s: Export to Language
-
None
-
Environment:Reproduced both on Windows and MacOS
-
Not Needed
Problem Description
Consulting client of mine ran into this - when building an aggregation pipeline that uses the uncorrelated sub-pipeline form of the $lookup stage rather than the form that uses to and from fields, the export to language function for Java fails with the error "Unrecognized option for $lookup: let" instead of generating Java code when the "Use Builders" option is selected. The export to language feature will generate code (albeit rather verbose code) if the "Use Builders" option is not selected.
Steps to Reproduce
1. Create a single stage aggregation pipeline with a $lookup stage and
pass in the following settings to the aggregation pipeline builder
for the $lookup stage:
{{{}}
from: 'tree',
let: { parent_id : "$parent" }, pipeline : [ {
{{ $match: { $expr:
} } ], }}
as: 'referenced_in'
}
2. Select Export Pipeline Code to Language
3. In the Export Pipeline To Language dialog, select "Java" as the
language and ensure that the "Use Builders" option is selected.
Expected Results
After following the three steps above, the client expected Compass to generate Java code using the "uncorrelated subquery" syntax as described in our driver documentation here.
Actual Results
Client received an error message "Unrecognized option to $lookup: let" instead. I was am able to reproduce this with Compass 1.25 (Compass 1.26 has the "Use Builders" option disabled as Maurizio Casimirri told me on Slack) - please see attached screen shot.
Additional Notes
- duplicates
-
COMPASS-4111 Export $lookup aggregate to java fails
- Closed
- related to
-
COMPASS-4695 Bring back builders in export to language for Java
- Closed