Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-4681

Compass 1.25.0 Java Export To Language with $lookup with sub-pipeline fails when using "Use Builders"

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • No version
    • 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:

      { $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

            Assignee:
            Unassigned Unassigned
            Reporter:
            timo.geusch@mongodb.com Timo Geusch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: