Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-1371

The tailable cursor cannot get document through __getitem__(index) on MongoDB v3.4+

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 3.5.1
    • Fix Version/s: 3.6
    • Component/s: API
    • Labels:
    • Environment:
      CentOS release 6.6 (Final) & Python 2.6.6
      CentOS Linux release 7.3.1611 (Core) & Python 2.7.5
      MongoDB v3.4.5 / v3.4.6

      Description

      The tailable cursor cannot get document through __getitem__(index), e.g. cursor[0], even through cursor.count() is greater than 0.
      It can works on MongoDB v3.2 or earlier´╝î but not on MongoDB v3.4.

      Trackback likes:

        File "/usr/lib64/python2.6/site-packages/pymongo-3.5.1-py2.6-linux-x86_64.egg/pymongo/cursor.py", line 586, in __getitem__
          raise IndexError("no such item for Cursor instance")
      IndexError: no such item for Cursor instance
      

      I debug it and find out the intermediate response in cursor.__send_message() as follows:

      {'number_returned': 1, 'data': [SON([(u'ok', 0.0), (u'errmsg', u"cannot use tailable option with the 'singleBatch' option"), (u'code', 2), (u'codeName', u'BadValue')])], 'starting_from': 0, 'cursor_id': 0}
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: