MongoDB游标是否“自动增长"?当我添加文件时 [英] Does a MongoDB cursor "auto-grow" when I add documents

查看:82
本文介绍了MongoDB游标是否“自动增长"?当我添加文件时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MongoDB游标查找大量文档,这需要花费一些时间.如果在这段时间内将添加到数据库中的文档与游标的搜索条件相匹配,将会发生什么情况.

I am using a MongoDB cursor to find a large number of documents, which takes quite some time. What happens if during this time, there are documents added to the database that match the search criteria of the cursor.

光标会返回文档吗? 还是游标开始时会进行某种快照,从而忽略了以后添加的结果?

Will the cursor return the documents? Or does the cursor take some kind of snapshot if it begins, and thus omits the later added results?

推荐答案

光标会返回文档吗?

Will the cursor return the documents?

是的.当您更新从游标接收到的某些文档,导致它们超出当前磁盘范围并移至数据文件中更大的插槽时,也会发生这种情况.在这种情况下,您可能会两次(或多次)看到此类文档.

Yes. This also happens when you update some documents which you received from the cursor, causing them to grow out of their current disk bounds and move to a bigger slot in the data files. In this case, you may see such documents twice (or more).

这篇关于MongoDB游标是否“自动增长"?当我添加文件时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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