Skip to content

Commit

Permalink
Polish MongoClients
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand committed Nov 1, 2024
1 parent 3d022be commit 200944f
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@ public ClusterSettingBuilder(MongoClientConfig config) {
@Override
public void apply(ClusterSettings.Builder builder) {
Optional<String> maybeConnectionString = config.connectionString;
if (!maybeConnectionString.isPresent()) {
if (maybeConnectionString.isEmpty()) {
// Parse hosts
List<ServerAddress> hosts = parseHosts(config.hosts);
builder.hosts(hosts);

if (hosts.size() == 1 && !config.replicaSetName.isPresent()) {
if (hosts.size() == 1 && config.replicaSetName.isEmpty()) {
builder.mode(ClusterConnectionMode.SINGLE);
} else {
builder.mode(ClusterConnectionMode.MULTIPLE);
Expand Down

0 comments on commit 200944f

Please sign in to comment.