Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-5326 consistency/isolation/recency tracking ticket
  3. DOCS-5324

Document how to use findAndModify with write concern to achieve "quorum read" behavior

    • Type: Icon: Sub-task Sub-task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • mongodb-3.1.x
    • 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:

      1. The findAndModify must use exact match satisfiable with an existing unique index.
      2. The findAndModify must modify some field in the document. I recommend using $inc to increment a field with a name like {{ _dummy_counter_}}.
      3. The write concern used with the findAndModify must be w:majority

      Caveats: Not all drivers support findAndModify with write concern.

            Assignee:
            kyle.suarez@mongodb.com Kyle Suarez
            Reporter:
            schwerin@mongodb.com Andy Schwerin
            Votes:
            0 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved:
              7 years, 40 weeks, 2 days ago