[COMPASS-4239] Agg builder doesn't work with set & unset stages Created: 14/Apr/20  Updated: 29/Oct/23  Resolved: 20/Apr/20

Status: Closed
Project: Compass
Component/s: Aggregation pipeline
Affects Version/s: 1.20.5, 1.21.0
Fix Version/s: 1.21.0

Type: Bug Priority: Major - P3
Reporter: Paul Done Assignee: Durran Jordan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 18.04


Attachments: PNG File Screenshot from 2020-04-14 09-50-36.png    
Sprint: Iteration Blackberry

 Description   

issues trying to use $set & $unset in Compass Aggregation builder (Compass v1.20.5 & 1.21.0-beta.4 - Ubuntu 18.04)?

Mongo Shell happily executes my pipeline but Compass doesn't like it and reports format errors.

// agg pipeline that works in shell but when imported into Compass causes problems:
    [{$unwind: {
      path: '$members'
    }}, {$unwind: {
      path: '$members.name'
    }}, {$group: {
      _id: '$members.name',
      number: {$sum: 1}
    }}, {$sort: {
      number: -1
    }}, {$limit: 10
    }, {$set: {
      name: '$_id.val'
    }}, {$unset: ['_id']
    }]

See attached screenshot showing Compass errors.

Note, when imported into Compass, no errors are initially shown but the pipeline doesn't produce results. Go into the $set or $unset stage, remove an apostrophe character (or whatever) and then re-add the same identical character and the Compass errors will then be shown.



 Comments   
Comment by Asya Kamsky [ 14/Apr/20 ]

$set and $unset were added in 4.2 as new aliases for existing stage/syntax.

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