[DOCS-14249] Investigate changes in SERVER-54236: Implement $count accumulator Created: 24/Feb/21  Updated: 13/Nov/23  Due: 09/Apr/21  Resolved: 08/Apr/21

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: 4.9.0, Server_Docs_20231030, Server_Docs_20231106, Server_Docs_20231105, Server_Docs_20231113

Type: Task Priority: Major - P3
Reporter: Backlog - Core Eng Program Management Team Assignee: Joseph Dougherty
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
documents SERVER-54236 Implement $count accumulator Closed
Participants:
Days since reply: 2 years, 43 weeks, 6 days ago
Epic Link: DOCSP-9747

 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.)



 Comments   
Comment by Githook User [ 08/Apr/21 ]

Author:

{'name': 'Joseph Dougherty', 'email': 'joseph.dougherty@mongodb.com', 'username': 'jmd-mongo'}

Message: DOCS-14249 documents new count accumulator
Branch: v5.0
https://github.com/mongodb/docs/commit/86c9cf3ee685e7c919b0dfdb29b0ac16bfe3803d

Generated at Thu Feb 08 08:09:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.