Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-14249

Investigate changes in SERVER-54236: Implement $count accumulator

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.9.0
    • Component/s: manual, Server
    • Labels:
      None
    • Last comment by Customer:
      true
    • 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

            Activity

              People

              Assignee:
              joseph.dougherty Joseph Dougherty
              Reporter:
              backlog-server-pm Backlog - Core Eng Program Management Team
              Participants:
              Last commenter:
              Joseph Dougherty Joseph Dougherty
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved:
                Days since reply:
                1 week, 1 day ago
                Date of 1st Reply: