Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1088

Retryable writes enabled by default

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • No version
    • Affects Version/s: 1.1.7
    • Component/s: Embedded Shell
    • Labels:
      None
    • Needed
    • Hide

      The referenced documentation in https://docs.mongodb.com/manual/core/retryable-writes/#enabling-retryable-writes should be updated to state that mongosh performs retryable writes by default.

      Show
      The referenced documentation in https://docs.mongodb.com/manual/core/retryable-writes/#enabling-retryable-writes should be updated to state that mongosh performs retryable writes by default.

      Problem Statement/Rationale

      The documentation says you must add the option --retryWrites to enable retryable writes|https://docs.mongodb.com/manual/core/retryable-writes/#enabling-retryable-writes]. 

      Rather, experimentation with mongosh 1.1.7 shows that retryable writes are enabled by default, and you must add the option --retryWrites=false to disable them.

      Steps to Reproduce

      1. Create a replica set on MongoDB 4.4.10. (I'm sure other releases would exhibit the same behavior)
      2. Connect with mongosh as a replica set.
      3. Run a script that inserts and/or updates a bunch of documents.
      4. Observe the FTDC metric "transactionsCollectionWriteCount". (or you can use the serverStatus command)
      5. Note that metrics spikes exactly as the updates spike.
      6. Now run mongosh again with the --retryWrites=false option.
      7. Observe that the "transactionsCollectionWriteCount" metric does not spike, indicating retryable writes are not being used.

      This behavior is inconsistent with the mongo shell, which disables retryable writes by default. The documentation is also incorrect.

      Fixing the documentation is one option here.

      Expected Results

      What do you expect to happen?

      Actual Results

      What do you observe is happening?

      Additional Notes

      Any additional information that may be useful to include.

            Assignee:
            Unassigned Unassigned
            Reporter:
            spencer.brown@mongodb.com Spencer Brown
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: