pymongo操作错误

问题描述:

我从我的MongoDB一路上得到了很多纪录,我得到一个错误pymongo操作错误

File "C:\database\models\mongodb.py", line 228, in __iter__ 
    for result in self.results: 
    File "C:\Python27\Lib\site-packages\pymongo\cursor.py", line 814, in next 
    if len(self.__data) or self._refresh(): 
    File "C:\Python27\Lib\site-packages\pymongo\cursor.py", line 776, in _refresh 
    limit, self.__id)) 
    File "C:\Python27\Lib\site-packages\pymongo\cursor.py", line 720, in __send_message 
    self.__uuid_subtype) 
    File "C:\Python27\Lib\site-packages\pymongo\helpers.py", line 99, in _unpack_response 
    cursor_id) 

pymongo.errors.OperationFailure: cursor id '866472135294727793' not valid at server 
Exception KeyError: KeyError(38556896,) in <module 'threading' from 'C:\Python27\lib\threading.pyc'> ignored 

这是什么意思,我如何解决它。我不知道这是否是重要的,但我没有 使用from gevent import monkey; monkey.patch_all()当我打开连接

+1

当要求别人来解决你的代码,它有助于提供的代码。 – kindall 2013-02-20 15:53:02

当光标已经开了很长的时间上没有操作,它(光标)可以超时 - >这导致到错误

您可以设置超时时间=假在查找查询打开超时断

reference