[COMPASS-4512] Error generating java code Created: 20/Nov/20  Updated: 29/Oct/23  Resolved: 27/Jan/21

Status: Closed
Project: Compass
Component/s: Aggregation pipeline
Affects Version/s: 1.22.1, 1.23.0
Fix Version/s: No version

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

Attachments: PNG File Screen Shot 2020-11-19 at 5.09.18 PM.png    
Issue Links:
Duplicate
duplicates COMPASS-4475 Aggregation tool generating Java code... Closed
Documentation Changes: Not Needed

 Description   

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



 Comments   
Comment by Massimiliano Marcon [ 27/Jan/21 ]

We need to update the snippet to support the changes in the latest Java driver. Tracking this in COMPASS-4475.

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