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

Error generating java code

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • No version
    • Affects Version/s: 1.22.1, 1.23.0
    • Component/s: Aggregation pipeline
    • None
    • Not Needed

      Problem Description

      A valid aggregation pipeline generates the error $eq cannot be top-level" when an attempt is made to export to java

      Steps to Reproduce

      The following test pipeline demonstrates the problem:[{$addFields: {
      "elemZero":

      { $arrayElemAt: ["$LOANMI", 0] }

      ,
      "elemOne":

      { $arrayElemAt: ["$LOANMI", 1] }

      }}, {$group: {
      _id: null,
      "MICancellation": {
      $push: {
      $cond: {
      if: {
      $and: [{
      "$eq": [

      { $ifNull: ["$elemZero", "unspecified"] }

      , "unspecified"]
      },
      {
      "$eq": [

      { $type: "$elemOne" }

      , "date"]
      }
      ]
      },
      then: "$_id",
      else: null
      }
      }
      }
      }}]

      Expected Results

      Java code generated

      Actual Results

      Error message $eq cannot be top-level" is generated.

       

      Additional Notes

      Reported by Customer Freddie Mac

            Assignee:
            Unassigned Unassigned
            Reporter:
            peter.williamson@mongodb.com Peter Williamson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: