-
Type: Bug
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: 3.6.0
-
Component/s: Wire Protocol
-
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".