`CountDocuments` slowly

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Gone away
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      use `CountDocuments` to get count is slowly than useing mongoshell, By looking log of mongodb, it seems like `CountDocuments` will use `aggregate` to compute count.

      mongoshell spend 1660ms, `CountDocuments` spend 2436ms. the filter count is 349326,  the collection count is 19492668, and i have created index.

      Are there any way to improve the performance?

            Assignee:
            Benji Rewis (Inactive)
            Reporter:
            du liu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: