Hi Team,
I was trying to build a aggregation pipeline in Compass and getting error:
Error Code:
Expected "[" or AggregationStage but "{" found.
Pipeline that I was trying to build in match stage:
{$expr:{$gt:["$stars",{$subtract:["$postal_code", 14400000]}]}}
Compass version that I am using: Version 1.19.12 (1.19.12)
In mongo shell it's woking fine, however in Compass I am getting the same error.
Command in mongo shell that I am executing:
db.tips.aggregate([{$match:{$expr:{$gt:["$stars",{$subtract:["$postal_code", 14400000]}]}}}])
However, If I remove the subtract from the pipeline it works fine.
{$expr:{$gt:["$stars","$likes"]}}
I got same error in Atlas Data explorer as well. After discussing this issue in Compass channel, I have opened this ticket.