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+

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.6
    • Affects Version/s: 3.5.1
    • Component/s: API
    • 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

      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}
      

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            caosiyang caosiyang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: