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

MongoClientSettings do not works properly

    • Type: Icon: Question Question
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 5.0.1
    • Component/s: API
    • None
    • Java Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Let`s say I would like to override default connection pool size from 100 to 10.

      I will have following piece of code:

      `

      val clientSettings = MongoClientSettings.builder()  .applyToConnectionPoolSettings{
          ConnectionPoolSettings.builder().maxSize(10).build()  }
        .applyConnectionString(ConnectionString(mongoProperties.uri))
        .build()
      return MongoClients.create(clientSettings)

      `

      It should set the max size to 10 but instead of I get 100(default value), this value is populated when applyConnectionString is applied to the MongoClientSettings.

      Basically it overrides the values that I provided as I understand.

      As a workaround I can set: maxPoolSize value to the : mongoProperties.uri and use it without applyToConnectionPoolSettings.

       

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            andreilisa2001@gmail.com Lisa Andei
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: