I keep getting the following exception from my java mongodb client:
Caused by: com.mongodb.MongoCursorNotFoundException: Query failed with error code -5 and error message 'Cursor 105639140478 not found on server server1:27017' on server server1:27017
The code is as follows:
MongoCollection<Document> db = (bunch of code to load up one of these objects)
FindIterable<Document> cur = db.find().projection(desiredFields).noCursorTimeout(true);
MongoCursor<Document> cursor = cur.iterator();
while(cursor.hasNext()) {
Document o = cursor.next();
doStuff(o);
}
I have set the noCursorTimeout, but I am still getting the exception. It processes about 110,000 records before timing out, so it is clearly capable of sort-of working (otherwise it would process no records) but at the same time it isn't working properly either, because I would expect it to not time out after specifically setting noCursorTimeout(true).