[COMPASS-4681] Compass 1.25.0 Java Export To Language with $lookup with sub-pipeline fails when using "Use Builders" Created: 08/Mar/21  Updated: 29/Oct/23  Resolved: 10/Mar/21

Status: Closed
Project: Compass
Component/s: Export to Language
Affects Version/s: 1.25.0
Fix Version/s: No version

Type: Bug Priority: Minor - P4
Reporter: Timo Geusch Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Reproduced both on Windows and MacOS


Attachments: PNG File Screen Shot 2021-03-04 at 3.58.52 PM.png    
Issue Links:
Duplicate
duplicates COMPASS-4111 Export $lookup aggregate to java fails Open
Related
related to COMPASS-4695 Bring back builders in export to lang... Needs Triage
Documentation Changes: Not Needed

 Description   

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:

{ $in: [ "$$parent_id", "$ancestors" ] }

} } ], }}
  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



 Comments   
Comment by Massimiliano Marcon [ 10/Mar/21 ]

Thank you timo.geusch for the detailed report. This seems to be the same as COMPASS-4111.

Worth pointing out that in Compass 1.26, we temporarily disabled the use of builders as the syntax we generate is incompatible with the most recent stable version of the Java driver. We are planning to enable them again once the new version of the Java driver is out.

Generated at Wed Feb 07 22:37:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.