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

Investigate NODE-3867 - FindCursor.count() returns limit count instead of document that matched query count

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • 1
    • Not Needed

      NODE-3867 Description

      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:
            bailey.pearson@mongodb.com Bailey Pearson
            Reporter:
            dbeng-pm-bot PM Bot
            Bailey Pearson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: