Always set slaveOk for direct connections to replica set members

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor - P4
    • 3.6.2
    • Affects Version/s: 3.6.0
    • Component/s: Wire Protocol
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When an application creates a MongoClient instance that is a direct connection (topology type of "Single" in the parlance of the server selection specification) to a replica set member (e.g. new MongoClient(new ServerAddress("localhost", 27018)), and the read preference mode is "primary", then messages sent to that server via that MongoClient should indicate that the server should execute them regardless of whether the server is the primary member of the replica set.

      For OP_QUERY (for MongoDB versions < 3.6), that means settings the slaveOk wire protocol bit.

      For OP_MSG (for MongoDB versions >= 3.6), that means including a $readPreference field with mode of "primaryPreferred".

              Assignee:
              Jeffrey Yemin
              Reporter:
              Jeffrey Yemin
              None
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: