[COMPASS-3195] $sortByCount in Aggregation should not have curly braces Created: 12/Oct/18  Updated: 08/Aug/21  Resolved: 24/Jun/19

Status: Closed
Project: Compass
Component/s: Compass
Affects Version/s: 1.16.0-beta.7
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Matt Kalan Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: JPEG File IMG_0457.JPG     JPEG File IMG_0461.JPG    
Issue Links:
Related
related to COMPASS-4996 Improve $sortByCount template example... Open

 Description   

In the Aggregation tab, when I choose $sortByCount, it generates curly braces but it looks like that causes an error and it should have no curly braces and just the expression. At least that worked correctly



 Comments   
Comment by Massimiliano Marcon [ 20/Nov/19 ]

matt.kalan you don't need to remove the comments, just the curly brackets. I understand this might be a bit annoying but it is not a bug. The template for $sortByCount has curly brackets because it's possible to specify an expression that evaluates to a document (https://docs.mongodb.com/manual/reference/operator/aggregation/sortByCount/#pipe._S_sortByCount).

In your case, for example, a $sortByCount with this expression would lead to the same result:

{$mergeObjects: ['$airplane']}

Comment by Mark Callaghan [ 19/Nov/19 ]

Sorry for uploading giant photos. I hope you can delete them soon.

Comment by Mark Callaghan [ 19/Nov/19 ]

This is a problem for me with Compass 1.19.12

The fix is to remove the comment text and the curly brackets and then remove all newlines before the expression. Whitespace before the expression is OK.

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