what are the major differences between mongoclientoptions vs mongoclientsettings
Can anyone please give an example and elaborate where to use what with example?
what are the major differences between mongoclientoptions vs mongoclientsettings
Can anyone please give an example and elaborate where to use what with example?
The short answer from what I can tell is the MongoClientOptions
is the old way, whereas MongoClientSettings
is the new way.
The newest MongoDB Java driver (3.9 at time of writing this answer) supports the old client - i.e., com.mongodb.MongoClient() which takes as a parameter MongoClientOptions. See https://mongodb.github.io/mongo-java-driver/3.9/javadoc/com/mongodb/MongoClient.html.
The newer client has a different namespace - it is com.mongodb.client.MongoClient(). This client expects to be built using com.mongodb.client.MongoClients.create(), which takes a MongoClientSettings. See https://mongodb.github.io/mongo-java-driver/3.9/javadoc/com/mongodb/client/MongoClients.html