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}