-
Type: Bug
-
Resolution: Duplicate
-
Priority: Minor - P4
-
None
-
Affects Version/s: 2.7.3
-
Component/s: Connection Management
When the connection string contains slaveOk=true as an option then the following line of (groovy) code may read from a secondary server in a replica set:
collection.findOne(new BasicDBObject([_id: key]),null, ReadPreference.PRIMARY)
I believe that this may well affect all find methods.
This appears to be due to the code in OutMethod.appendQuery() which ORs in Bytes.QUERYOPTION_SLAVEOK if the read preference is NOT primary but does nothing if the read preference is primary.
- is related to
-
JAVA-474 Enhance read preference support
- Closed