Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-54235

Implement $count window function desugaring

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • Query Optimization 2021-02-22, Query Optimization 2021-03-08, Query Optimization 2021-03-22, Query Optimization 2021-04-05, Query Optimization 2021-04-19, Query Optimization 2021-05-03

      From Syntax:

      $count

      This is a new accumulator which returns the number of documents in the current window/partition. In $group, it is identical to {newField: {$sum: 1}} but will only be exposed as a window function. It is an error to specify an input expression to $count, but a non-default window may be specified.

      {newField: {$count: {}, window: ...}}

       

       

      From Technical Design Document: 

      A $count window function will be desugared to a $sum with an input expression of the constant '1'. The window definition will remain the same.

            Assignee:
            joel.redman@mongodb.com Joel Redman (Inactive)
            Reporter:
            nicholas.zolnierz@mongodb.com Nicholas Zolnierz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: