我在 pymongo 中尝试过以下命令:
records= db.collection_name.find({"gender":"female"}).batch_size(5)
但经过几次迭代后:
pymongo.errors.CursorNotFound: Cursor not found, cursor id: 61593385827.
另外,如果我在同一命令中尝试 timeout=False
,即
records= db.collection_name.find({"gender":"female"},timeout=False).batch_size(5)
它给了
TypeError: __init__() got an unexpected keyword argument 'timeout' error.
最佳答案
尝试在查询中设置 no_cursor_timeout=True
,如下所示:
records= db.collection_name.find({"gender":"female"}, no_cursor_timeout=True).batch_size(5)
https://stackoverflow.com/questions/32731140/
相关文章:
node.js - Mongoose 更新 : $inc is not working in ups
mongodb - Meteor.Collection 和 Meteor.Collection.Cu
ruby-on-rails - Mongoid 批量更新/Upsert 替代方案?
mongodb - Mongotemplate - 根据大于(gt)或小于(lt)运算符查询Obje
node.js - 我可以使用 MongoDb 驱动程序从 node.js 调用 rs.initia
c# - 从 2.0 MongoDb c# 驱动程序获取结果
java - Mongodb选择所有字段按一个字段分组并按另一个字段排序
java - 在最新的 MongoDB java 驱动程序中使用 createIndex() 时,索