Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does a MongoDB cursor "auto-grow" when I add documents

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?

like image 623
Pim Avatar asked Feb 25 '26 13:02

Pim


1 Answers

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).

like image 120
Sergio Tulentsev Avatar answered Feb 27 '26 04:02

Sergio Tulentsev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!