Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1287

cursor.count() is deprecated in the driver

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.6.0
    • Affects Version/s: None
    • Component/s: Shell API
    • None
    • 1
    • Needed
    • Hide

      The cursor.count() method is deprecated. Using it will print a warning in mongosh. Users should prefer collection.countDocuments(), collection.estimatedDocumentCount() or, if more compatibility with cursor.count() behavior is needed, collection.count().

      Its optional argument, applySkipLimit, has always been ignored by mongosh, defaulting to true (unlike the legacy shell, where it defaulted to false).

      Show
      The cursor.count() method is deprecated. Using it will print a warning in mongosh. Users should prefer collection.countDocuments() , collection.estimatedDocumentCount() or, if more compatibility with cursor.count() behavior is needed, collection.count() . Its optional argument, applySkipLimit , has always been ignored by mongosh, defaulting to true (unlike the legacy shell, where it defaulted to false ).
    • Iteration Jellyfish

      https://mongodb.slack.com/archives/C03MPA2FY6S/p1660312978525169

      https://github.com/mongodb/node-mongodb-native/pull/3127 / NODE-3867 deprecated the cursor .count() method. We need to figure out how to handle this in the shell, since we have a public, non-deprecated equivalent on our cursor class.

            Assignee:
            anna.henningsen@mongodb.com Anna Henningsen
            Reporter:
            anna.henningsen@mongodb.com Anna Henningsen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: