I am trying to iterate through this loop:
for doc in coll.find()
I get the following error at the 100,000th plus record.
File "build\bdist.win32\egg\pymongo\cursor.py", line 703, in next
File "build\bdist.win32\egg\pymongo\cursor.py", line 679, in _refresh
File "build\bdist.win32\egg\pymongo\cursor.py", line 628, in __send_message
File "build\bdist.win32\egg\pymongo\helpers.py", line 95, in _unpack_response
pymongo.errors.OperationFailure: cursor id '1236484850793' not valid at server
what does this error mean?
Maybe your cursor timed out on the server. To see if this is the problem, try to set timeout=False`:
See http://api.mongodb.org/python/1.6/api/pymongo/collection.html#pymongo.collection.Collection.find
If it was a timeout problem one possible solution is to set the
batch_size(s. other answers).