com.mongodb.MongoException$CursorNotFound: cursor not found on server异常处理,servernotfound
java链接MongoDB处理大量数据时经常碰到cursor not found 的异常,其实是超时所致
Exception in thread "main" com.mongodb.MongoException$CursorNotFound: cursor not found on server
at com.mongodb.DBApiLayer$Result.init(DBApiLayer.java:379)
at com.mongodb.DBApiLayer$Result._advance(DBApiLayer.java:426)
at com.mongodb.DBApiLayer$Result.hasNext(DBApiLayer.java:408)
at com.mongodb.DBCursor._hasNext(DBCursor.java:495)
at com.mongodb.DBCursor.hasNext(DBCursor.java:515)
DBCursor cursor = collection.find(condtion);
cursor.addOption(com.mongodb.Bytes.QUERYOPTION_NOTIMEOUT);
只要在查询的DBCursor添加com.mongodb.Bytes.QUERYOPTION_NOTIMEOUT就解决!
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。