Cursor Snapshot

51 views
Skip to first unread message

Felipe Santos

unread,
Feb 28, 2020, 12:44:11 AM2/28/20
to mongodb-user
Is it something we have to concern in version as of 4.0?

Cursor Snapshot

MongoDB cursors can return the same document more than once in some situations. As a cursor returns documents other operations may interleave with the query. If some of these operations change the indexed field on the index used by the query; then the cursor will return the same document more than once.

If your collection has a field or fields that are never modified, you can use a unique index on this field or these fields so that the query will return each document no more than once. Query with hint() to explicitly force the query to use that index.


https://docs.mongodb.com/manual/core/read-isolation-consistency-recency/#cursor-snapshot

Stennie

unread,
Mar 1, 2020, 9:32:00 PM3/1/20
to mongodb-user
Hi Felipe,

I see this question was asked and answered on the new MongoDB Community forum: Can cursors return the same document more than once in MongoDB 4.0?.

It would be best to continue any discussion on the MongoDB Community site, which is the replacement for this Google Group.

Thanks,
Stennie
Reply all
Reply to author
Forward
0 new messages