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

Initializing driver with a URI and slaveOk=false defaults reads to secondary

      There's a bug in com.mongodb.ConnectionString.java in the Java Driver.

              // handle legacy slaveok settings
              if (optionsMap.containsKey("slaveok") && !optionsMap.containsKey("readpreference")) {
                  optionsMap.put("readpreference", asList("secondaryPreferred"));
              }
      

      This check is assuming that if slaveok is set that it was set to slaveOk=true.

      Here's the commit that introduced this bug: https://github.com/mongodb/mongo-java-driver/commit/edb6952fd76ca9eba72b5f018717cb58c0745c0f

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            meverett@squarespace.com Michael Everett
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: