Using a local DNS server for Docker and a srv connection string, the application can connect successfully. The replicaset had to be modified to look like this. Is there an easier way to do this, like with the 2.30.0 driver?
{
"set" : "rs-local",
"date" : ISODate("2025-08-03T20:18:02.781+02:00"),
"myState" : 1,
"term" : 1,
"syncSourceHost" : "",
"syncSourceId" : -1,
"heartbeatIntervalMillis" : 2000,
"majorityVoteCount" : 1,
"writeMajorityCount" : 1,
"votingMembersCount" : 1,
"writableVotingMembersCount" : 1,
"optimes" : {
"lastCommittedOpTime" : {
"ts" : Timestamp({ t: 1754245073, i: 1 }),
"t" : 1
},
"lastCommittedWallTime" : ISODate("2025-08-03T20:17:53.658+02:00"),
"readConcernMajorityOpTime" : {
"ts" : Timestamp({ t: 1754245073, i: 1 }),
"t" : 1
},
"appliedOpTime" : {
"ts" : Timestamp({ t: 1754245073, i: 1 }),
"t" : 1
},
"durableOpTime" : {
"ts" : Timestamp({ t: 1754245073, i: 1 }),
"t" : 1
},
"writtenOpTime" : {
"ts" : Timestamp({ t: 1754245073, i: 1 }),
"t" : 1
},
"lastAppliedWallTime" : ISODate("2025-08-03T20:17:53.658+02:00"),
"lastDurableWallTime" : ISODate("2025-08-03T20:17:53.658+02:00"),
"lastWrittenWallTime" : ISODate("2025-08-03T20:17:53.658+02:00")
},
"lastStableRecoveryTimestamp" : Timestamp({ t: 1754245053, i: 1 }),
"electionCandidateMetrics" : {
"lastElectionReason" : "electionTimeout",
"lastElectionDate" : ISODate("2025-08-03T20:17:33.604+02:00"),
"electionTerm" : 1,
"lastCommittedOpTimeAtElection" : {
"ts" : Timestamp({ t: 1754245053, i: 1 }),
"t" : -1
},
"lastSeenWrittenOpTimeAtElection" : {
"ts" : Timestamp({ t: 1754245053, i: 1 }),
"t" : -1
},
"lastSeenOpTimeAtElection" : {
"ts" : Timestamp({ t: 1754245053, i: 1 }),
"t" : -1
},
"numVotesNeeded" : 1,
"priorityAtElection" : 1,
"electionTimeoutMillis" : 10000,
"newTermStartDate" : ISODate("2025-08-03T20:17:33.641+02:00"),
"wMajorityWriteAvailabilityDate" : ISODate("2025-08-03T20:17:33.709+02:00")
},
"members" : [
{
"_id" : 0,
"name" : "mongodb.tenant-management.local:27017",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 48,
"optime" : {
"ts" : Timestamp({ t: 1754245073, i: 1 }),
"t" : 1
},
"optimeDate" : ISODate("2025-08-03T20:17:53.000+02:00"),
"optimeWritten" : {
"ts" : Timestamp({ t: 1754245073, i: 1 }),
"t" : 1
},
"optimeWrittenDate" : ISODate("2025-08-03T20:17:53.000+02:00"),
"lastAppliedWallTime" : ISODate("2025-08-03T20:17:53.658+02:00"),
"lastDurableWallTime" : ISODate("2025-08-03T20:17:53.658+02:00"),
"lastWrittenWallTime" : ISODate("2025-08-03T20:17:53.658+02:00"),
"syncSourceHost" : "",
"syncSourceId" : -1,
"infoMessage" : "Could not find member to sync from",
"electionTime" : Timestamp({ t: 1754245053, i: 2 }),
"electionDate" : ISODate("2025-08-03T20:17:33.000+02:00"),
"configVersion" : 1,
"configTerm" : 1,
"self" : true,
"lastHeartbeatMessage" : ""
}
],
"ok" : 1,
"$clusterTime" : {
"clusterTime" : Timestamp({ t: 1754245073, i: 1 }),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : 0
}
},
"operationTime" : Timestamp({ t: 1754245073, i: 1 })
}
Without dns server de rs config is this ![]()
{
"set" : "rs-local",
"date" : ISODate("2025-08-03T20:31:47.827+02:00"),
"myState" : 1,
"term" : 2,
"syncSourceHost" : "",
"syncSourceId" : -1,
"heartbeatIntervalMillis" : 2000,
"majorityVoteCount" : 1,
"writeMajorityCount" : 1,
"votingMembersCount" : 1,
"writableVotingMembersCount" : 1,
"optimes" : {
"lastCommittedOpTime" : {
"ts" : Timestamp({ t: 1754245900, i: 1 }),
"t" : 2
},
"lastCommittedWallTime" : ISODate("2025-08-03T20:31:40.622+02:00"),
"readConcernMajorityOpTime" : {
"ts" : Timestamp({ t: 1754245900, i: 1 }),
"t" : 2
},
"appliedOpTime" : {
"ts" : Timestamp({ t: 1754245900, i: 1 }),
"t" : 2
},
"durableOpTime" : {
"ts" : Timestamp({ t: 1754245900, i: 1 }),
"t" : 2
},
"writtenOpTime" : {
"ts" : Timestamp({ t: 1754245900, i: 1 }),
"t" : 2
},
"lastAppliedWallTime" : ISODate("2025-08-03T20:31:40.622+02:00"),
"lastDurableWallTime" : ISODate("2025-08-03T20:31:40.622+02:00"),
"lastWrittenWallTime" : ISODate("2025-08-03T20:31:40.622+02:00")
},
"lastStableRecoveryTimestamp" : Timestamp({ t: 1754245743, i: 1 }),
"electionCandidateMetrics" : {
"lastElectionReason" : "electionTimeout",
"lastElectionDate" : ISODate("2025-08-03T20:31:10.617+02:00"),
"electionTerm" : 2,
"lastCommittedOpTimeAtElection" : {
"ts" : Timestamp({ t: 0, i: 0 }),
"t" : -1
},
"lastSeenWrittenOpTimeAtElection" : {
"ts" : Timestamp({ t: 1754245743, i: 1 }),
"t" : 1
},
"lastSeenOpTimeAtElection" : {
"ts" : Timestamp({ t: 1754245743, i: 1 }),
"t" : 1
},
"numVotesNeeded" : 1,
"priorityAtElection" : 1,
"electionTimeoutMillis" : 10000,
"newTermStartDate" : ISODate("2025-08-03T20:31:10.621+02:00"),
"wMajorityWriteAvailabilityDate" : ISODate("2025-08-03T20:31:10.724+02:00")
},
"members" : [
{
"_id" : 0,
"name" : "localhost:27017",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 37,
"optime" : {
"ts" : Timestamp({ t: 1754245900, i: 1 }),
"t" : 2
},
"optimeDate" : ISODate("2025-08-03T20:31:40.000+02:00"),
"optimeWritten" : {
"ts" : Timestamp({ t: 1754245900, i: 1 }),
"t" : 2
},
"optimeWrittenDate" : ISODate("2025-08-03T20:31:40.000+02:00"),
"lastAppliedWallTime" : ISODate("2025-08-03T20:31:40.622+02:00"),
"lastDurableWallTime" : ISODate("2025-08-03T20:31:40.622+02:00"),
"lastWrittenWallTime" : ISODate("2025-08-03T20:31:40.622+02:00"),
"syncSourceHost" : "",
"syncSourceId" : -1,
"infoMessage" : "Could not find member to sync from",
"electionTime" : Timestamp({ t: 1754245870, i: 1 }),
"electionDate" : ISODate("2025-08-03T20:31:10.000+02:00"),
"configVersion" : 1,
"configTerm" : 2,
"self" : true,
"lastHeartbeatMessage" : ""
}
],
"ok" : 1,
"$clusterTime" : {
"clusterTime" : Timestamp({ t: 1754245900, i: 1 }),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : 0
}
},
"operationTime" : Timestamp({ t: 1754245900, i: 1 })
}