-
Type: New Feature
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: Async, Configuration
-
None
Currently, mixing settings is extremely verbose compared to MongoClientURI.
A recent example is a user (SCALA-243) wanting to set the serverSelectionTimeoutMS in the Scala driver is:
val connectionString = new ConnectionString("mongodb://localhost/?connectTimeoutMS=500&socketTimeoutMS=500") val mongoClientSettings = MongoClientSettings.builder() .clusterSettings(ClusterSettings.builder().applyConnectionString(connectionString).serverSelectionTimeoutMS(500).build()) .connectionPoolSettings(ConnectionPoolSettings.builder().applyConnectionString(connectionString).build()) .serverSettings(ServerSettings.builder().build()).credentialList(connectionString.getCredentialList) .sslSettings(SslSettings.builder().applyConnectionString(connectionString).build()) .socketSettings(SocketSettings.builder().applyConnectionString(connectionString).build()) .build() MongoClient(mongoClientSettings)
Which is very verbose compared to the Sync driver:
String connectionString = "mongodb://localhost/?connectTimeoutMS=500&socketTimeoutMS=500"; MongoClientURI connectionStringAndOptions = new MongoClientURI(connectionString, MongoClientOptions.builder().serverSelectionTimeout(200)); new MongoClient(uriAndOptions);
- is related to
-
JAVA-2551 Make it easier to switch between sync & async drivers
- Closed