-
Type: Sub-task
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Server
-
Labels:
Per discussion in the comments of SERVER-17975, in MongoDB systems since at least 2.6, one can use findAndModify with a "w:majority" write concern to perform a read of data that cannot be rolled back and is not stale. We should document this technique for users that require it.
Highlights of the technique:
- The findAndModify must use exact match satisfiable with an existing unique index.
- The findAndModify must modify some field in the document. I recommend using $inc to increment a field with a name like {{ _dummy_counter_}}.
- The write concern used with the findAndModify must be w:majority
Caveats: Not all drivers support findAndModify with write concern.
- is related to
-
SERVER-17975 Stale reads with WriteConcern Majority and ReadPreference Primary
- Closed