mongodb游标何时过期 [英] When a mongodb cursor will expire

查看:208
本文介绍了mongodb游标何时过期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对mongodb一无所知,我只是想问一问是否有可能,如果可能的话,该怎么做.我的问题是我们如何知道游标何时到期.是否有为此目的的任何API?

I have no knowledge of mongodb and I just want to ask if something is possible and, if possible, how it can be done. My question is how can we know when a cursor will expire. Is there any API for this purpose?

如果有任何意见和建议,我将不胜感激.

I would be grateful for any comments and recommendations.

最好的问候.

推荐答案

来自MongoDB文档:

From the MongoDB documentation:

默认情况下,当客户端用尽了游标中的所有结果时,MongoDB将自动关闭游标.但是,对于有上限的集合,您可以使用在客户端耗尽初始游标中的结果之后仍保持打开状态的可尾游标".

http://docs.mongodb.org/manual/tutorial/create -tailable-cursor/

其他可能导致游标过期的因素是batchSize和timeout.总结一下,使光标过期的因素是:

Other factors which could cause a cursor to expire are the batchSize and timeout. To sum it up factors which expire the cursor are:

  • result exhausation
  • batchSize: http://docs.mongodb.org/manual/reference/method/cursor.batchSize/
  • timeout: http://api.mongodb.org/java/2.6/com/mongodb/MongoOptions.html

这篇关于mongodb游标何时过期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆