Skip to content

Commit

Permalink
Merge pull request #44249 from geoand/mongo-polish
Browse files Browse the repository at this point in the history
Polish MongoClients
  • Loading branch information
gsmet authored Nov 5, 2024
2 parents 98eaa3b + 200944f commit 4f49059
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 4f49059

Please sign in to comment.