Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-536

DBCursor.count() fails when querying a secondary server even if ReadPreference is SECONDARY

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • None
    • None
    • None
    • None

    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.

      Attachments

        Issue Links

          Activity

            People

              jeff.yemin@mongodb.com Jeffrey Yemin
              robjectlabs Robert Miyashiro
              Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: