Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-3867

FindCursor.count() returns limit count instead of document that matched query count

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 4.4.0
    • Affects Version/s: 4.2.2
    • Component/s: None
    • Labels:
    • 1
    • Not Needed

      What problem are you facing?

      `FindCursor.count()` is only returning the limit document count when using the limit option with a `collection.find()` command.

      What driver and relevant dependency versions are you using?

      Node.JS
      "mongodb": "^4.2.1",
      "mongodb-client-encryption": "^1.2.6",
       
      Steps to reproduce?
      1. Use `collection.find()` with a collection that has multiple documents returned.
      2. Use `cursor.count()` to retrieve all documents.
      3. Process the same `collection.find({}, {limit: 1})` with a collection that has multiple documents returned.
      4. See that the `count()` method only returns 1 as the total instead of the total documents that match the query

            Assignee:
            neal.beeken@mongodb.com Neal Beeken
            Reporter:
            nbordeau@greenactionstudio.com Nick Bordeau
            Bailey Pearson
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: