问题
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?
回答1:
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).
来源:https://stackoverflow.com/questions/50722428/does-a-mongodb-cursor-auto-grow-when-i-add-documents