countDocuments() executes aggregation with $group: { _id: 1 }

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: Query
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Whenever we use count in the end `count_documents` in Mongo::Collection::View::Readbale is called. This builds a pipeline with `$group: { _id: 1, n:

      { $sum: 1 }

      }``

       

      On a collection with about 3 mio documents this takes over 15 seconds to execute and consumes about 20 gb of memory.

      In my opinion this is a bug - or maybe a misunderstood feature?
      Can someone help me here?

              Assignee:
              Alex Bevilacqua
              Reporter:
              Patrick Lehmann
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: