MongoDB Java Driver Equivalent of Snapshot for MongoCursor

Viewed 434

After upgrading my MongoDB Java driver from version 2.14 to 3.2, I changed from using DBCursor to MongoCursor.

Previously, I was using snapshot() to prevent repetition when iterating through my large database of thousands of documents. However, I can't seem to find equivalent method for MongoCursor. This is causing troubling repetitions, e.g. 5571 loops for 4493 documents. That's like 24% more iterations! OMG!

So, my question is, is there a simple way or an equivalent method for MongoCursor that can prevent this from happening? If not, should I switch back to using DBCursor? It looks to still be supported in version 3.2.

Please kindly advise! Thank you!

1 Answers
Related