Details
-
Task
-
Resolution: Fixed
-
Major - P3
-
None
-
None
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
-