aggregation $count underperforms count()

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Works as Designed
    • Priority: Minor - P4
    • None
    • Affects Version/s: 3.7.3
    • Component/s: Aggregation Framework
    • None
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      i have a collection with 10m rows.

      this returns in like 10ms:

      db.getCollection('people').count()
      

      while this returns like 10s:

      db.getCollection('people').aggregate([{$count: 'count'}])
      

      doesn't seem to be related to https://jira.mongodb.org/browse/SERVER-7568, but similar in marked performance diff doing similar ops in aggregation and non-aggregation styles.

            Assignee:
            William Byrne III
            Reporter:
            tony kerz
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: