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

ClusterSettings does not compute ClusterConnectionMode consistently

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 5.0.0
    • Affects Version/s: None
    • Component/s: Configuration
    • None
    • Major Change
    • Needed
    • Hide

      Let's mention in What's new that we fixed the way ClusterConnectionMode is computed by ClusterSettings. ClusterSettings.getMode now consistently returns ClusterConnectionMode.MULTIPLE if the replica set name is configured, whether via ClusterSettings.Builder.applyConnectionString or via ClusterSettings.Builder. requiredReplicaSetName. Previously, this was happening only if the replica set name was configured via a connection string.

      Show
      Let's mention in What's new that we fixed the way ClusterConnectionMode is computed by ClusterSettings . ClusterSettings.getMode now consistently returns ClusterConnectionMode.MULTIPLE if the replica set name is configured, whether via ClusterSettings.Builder.applyConnectionString or via ClusterSettings.Builder. requiredReplicaSetName . Previously, this was happening only if the replica set name was configured via a connection string.

      The following code computes ClusterConnectionMode.MULTIPLE

      ClusterSettings.builder()
              .applyConnectionString(new ConnectionString("mongodb://127.0.0.1:27017/?replicaSet=replset"))
              .build()
              .getMode()
      

      but its direct counterpart that does not use applyConnectionString computes ClusterConnectionMode.SINGLE

      ClusterSettings.builder()
              .hosts(Collections.singletonList(
                      new ServerAddress("127.0.0.1", 27017)
              ))
              .requiredReplicaSetName("replset")
              .build()
              .getMode()
      

            Assignee:
            valentin.kovalenko@mongodb.com Valentin Kavalenka
            Reporter:
            valentin.kovalenko@mongodb.com Valentin Kavalenka
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: