Deprecation Error

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Works as Designed
    • Priority: Minor - P4
    • None
    • Affects Version/s: 3.7.2
    • Component/s: Query Operations
    • None
    • Environment:
      Windows 10; 64-bit
    • None
    • Minor Change
    • None
    • None
    • None
    • None
    • None
    • None

      This all happens within pymongo. I have created a cursor from a collection using a find on the collection. When I do a "cursor.count()", I receive the deprecation warning -
      -----------------
      D:/MyDocuments/SoftwareStuff/Python/Mongo/mongoPeople/devPeople/PeopleShell.pyw:1: DeprecationWarning: count is deprecated. Use Collection.count_documents instead.
      #!/usr/bin/env python
      111
      -----------------
      The count matches the count I get when perform the find using Compass.

      However, if I try to execute the "cursor.count_documents" (and its variations), I receive an error that the function does not exist. -
      -----------------
      the_cllctn.count_documents()
      Traceback (most recent call last):
      File "<input>", line 1, in <module>
      AttributeError: 'Cursor' object has no attribute 'count_documents'
      the_cllctn.count_documents
      Traceback (most recent call last):
      File "<input>", line 1, in <module>
      AttributeError: 'Cursor' object has no attribute 'count_documents'
      -------------------

      I am just bringing this to your attention.
      Randy Raymond

              Assignee:
              Shane Harvey
              Reporter:
              Randy Raymond [X]
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: