Trying to connect Atlas server less database using below proposed connection string:
mongodb+srv://USER_NAME:PASSWORD@MONGO_CLUSTER.6zmxa.mongodb.net/MONGO_DATABASE?retryWrites=true&w=majority;
getting below exception
A TXT record is only permitted to contain the keys [authsource, replicaset], but the TXT record for ‘serverlessinstance0.6zmxa.mongodb.net’ contains the keys [loadbalanced, authsource]
POM.xml
org.mongodb mongodb-driver-sync 4.5.0Code
ConnectionString connectionString = new ConnectionString(MONGO_URL);
MongoClientSettings settings = MongoClientSettings.builder()
.applyConnectionString(connectionString)
.applyToSslSettings(builder →
builder.enabled(true))
.serverApi(ServerApi.builder()
.version(ServerApiVersion.V1)
.build())
.build();
MongoClient mongoClient = MongoClients.create(settings);
any help would be highly appreciated