Details
-
Bug
-
Status: Closed
-
Minor - P4
-
Resolution: Duplicate
-
2.7.3
-
None
Description
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.
Attachments
Issue Links
- is related to
-
JAVA-474 Enhance read preference support
-
- Closed
-