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

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: mongodb-3.1.x
    • Component/s: Server
    • Labels:
    • # Replies:
      15
    • Last comment by Customer:
      true

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                14 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since reply:
                  3 years, 19 weeks, 4 days ago
                  Date of 1st Reply: