Java legacy driver MongoClientOptions gone

In the mongodb-driver-legacy (4…0.4) I could find the class MongoClientOptions to set for example:

It looks like in the mongodb-driver-sync (4.0.4), this class is replaced by MongoClientSettings, but it’s missing the connectionsPerHost.
Could someone indicate me where could I configure this in the new lib?

MongoClientSettings is a bit different from MongoClientOptions in that there are nested settings classes within it. For connection pool management, for example, there is com.mongodb.connection.ConnectionPoolSettings, which has maxSize, minSize, etc properties. Within the context of MongoClientSettings, you can figure this via the method com.mongodb.MongoClientSettings.Builder#applyToConnectionPoolSettings

1 Like