$count aggregation stage does return nothing when count is zero

XMLWordPrintableJSON

    • Query Optimization
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      I was using the aggregation stage $count and noticed that if the input dataset was empty that $count does not return anything.

      I was expecting it to return 0.

      There is nothing specified in the docs to expect this behaviour.
      https://www.mongodb.com/docs/manual/reference/operator/aggregation/count/

              Assignee:
              [DO NOT USE] Backlog - Query Optimization
              Reporter:
              Daniel Müller
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated: