cursor.count() is deprecated in the driver

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 1.6.0
    • Affects Version/s: None
    • Component/s: Shell API
    • None
    • 1
    • Iteration Jellyfish
    • 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 ).

      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
            Reporter:
            Anna Henningsen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: