[COMPASS-3966] $subtract is not supported in Aggregation Builder Created: 15/Nov/19  Updated: 29/Oct/23  Resolved: 22/Nov/19

Status: Closed
Project: Compass
Component/s: Compass
Affects Version/s: None
Fix Version/s: 1.20.0

Type: Bug Priority: Major - P3
Reporter: Saurav Vaid Assignee: Maurizio Casimirri
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File 1.19.png     PNG File 1.20.0-beta.9.png    
Issue Links:
Depends
Sprint: Iteration Ragamuffin

 Description   

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.


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