Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-3064

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

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Query
    • 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@mongodb.com Alex Bevilacqua
            Reporter:
            admin@patricklehmann.ch Patrick Lehmann
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: