[SERVER-29620] Add shorthand syntax for retrieving the record count for a collection using the $collStats agg stage Created: 14/Jun/17 Updated: 30/Oct/23 Resolved: 16/Jun/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework, Querying |
| Affects Version/s: | None |
| Fix Version/s: | 3.5.9 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | David Storch | Assignee: | Nicholas Zolnierz |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||
| Sprint: | Query 2017-06-19 | ||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Linked BF Score: | 0 | ||||||||||||||||||||
| Description |
|
The number of documents in a collection can already be retrieved using $collStats in O(1) time—that is, without executing a query to count the total number of documents. However, we would like to provide syntactic sugar in order to make this easy. Specifically, we will add a count option to $collStats:
This aggregation will return a single document with the ns and localTime fields, just like other $collStats pipelines. The count will be reported in a new field called count. |
| Comments |
| Comment by Githook User [ 16/Jun/17 ] |
|
Author: {u'username': u'nzolnierzmdb', u'name': u'Nick Zolnierz', u'email': u'nicholas.zolnierz@mongodb.com'}Message: |
| Comment by Githook User [ 15/Jun/17 ] |
|
Author: {u'username': u'jseyster', u'name': u'Justin Seyster', u'email': u'justin.seyster@mongodb.com'}Message: Revert " This reverts commit 1efbf03521e9c6d85df33ab6786f6c121d8b56c2. |
| Comment by Kyle Suarez [ 15/Jun/17 ] |
|
Marking Drivers Changes as "Maybe", as it's possible in the future that drivers may want to expose fast count to the users in this manner. |
| Comment by Githook User [ 15/Jun/17 ] |
|
Author: {u'username': u'nzolnierzmdb', u'name': u'Nick Zolnierz', u'email': u'nicholas.zolnierz@mongodb.com'}Message: |