Details
-
Type:
Task
-
Status: Resolved
-
Priority:
Major - P3
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 4.9.0
-
Labels:None
-
Last comment by Customer:true
-
Epic Link:
-
Sprint:ServerDocs2020: Mar2 - Mar9, ServerDocs2020: Mar9 - Mar16, ServerDocs2020: Mar16 - Mar23, ServerDocs2020: Mar23 - Mar30, ServerDocs2020: Mar30 - Apr06, ServerDocs2020: Apr6 - Apr13
Description
Description
Downstream Change Summary
This ticket adds $count as an accumulator to the $group stage:
{ $count: {} }
|
is desugared to:
{ $sum: 1 } |
Description of Linked Ticket
This task is for adding support for $count as an accumulator to the $group stage.
Scope of changes
New accumulator: https://docs.mongodb.com/manual/reference/operator/aggregation/#accumulators-group
Make sure we update https://docs.mongodb.com/manual/reference/operator/aggregation/group/#count-the-number-of-documents-in-a-collection as part of this change.
Also:
https://docs.mongodb.com/manual/reference/operator/aggregation/count/
Behavior section, current:
db.collection.aggregate( [
|
{ $group: { _id: null, myCount: { $sum: 1 } } }, |
{ $project: { _id: 0 } } |
] )
|
Desired:
db.collection.aggregate( [
|
{ $group: { _id: null, myCount: { $count: {} } } }, |
{ $project: { _id: 0 } } |
] )
|
Impact to Other Docs
MVP (Work and Date)
Resources (Scope or Design Docs, Invision, etc.)
Attachments
Issue Links
- documents
-
SERVER-54236 Implement $count accumulator
-
- Closed
-