[JAVA-536] DBCursor.count() fails when querying a secondary server even if ReadPreference is SECONDARY Created: 08/Mar/12  Updated: 19/Oct/16  Resolved: 12/Aug/12

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Robert Miyashiro Assignee: Jeffrey Yemin
Resolution: Duplicate Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates JAVA-497 ReadPrefs ignored for commands Closed

 Description   

Since DB.slaveOk() is deprecated, I switched to using DB.setReadPreference(SECONDARY) instead. If I have a Mongo connection to a secondary member, and I set the ReadPreference to SECONDARY, I'm able to successfully make queries and perform other operations, but I cannot call DBCollection.count() or DBCursor.count(). In both cases, I get the same "not talking to master and retries used up" error that happens when ReadPreference isn't set correctly. If I switch back to using DB.slaveOk(), the error goes away.


Generated at Thu Feb 08 08:52:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.