-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Connections
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
https://stackoverflow.com/questions/62687852/mongo-db-closed-connection-issue-from-springboot-client shows that the Java driver provides server connection id to clients:
Closed connection [connectionId{localValue:7, serverValue:1381867}] to because the pool has been closed. org.mongodb.driver.connection Closed connection [connectionId{localValue:4, serverValue:1382308}] to because there was a socket exception raised by this connection.
I checked ismaster and it appears to be the `connectionId` field:
MongoDB Enterprise > db.runCommand({ismaster:1})
{
"ismaster" : true,
"topologyVersion" : {
"processId" : ObjectId("5efd466aeb8ca26d40b472a8"),
"counter" : NumberLong(0)
},
"maxBsonObjectSize" : 16777216,
"maxMessageSizeBytes" : 48000000,
"maxWriteBatchSize" : 100000,
"localTime" : ISODate("2020-07-02T04:50:45.771Z"),
"logicalSessionTimeoutMinutes" : 30,
"connectionId" : 86,
"minWireVersion" : 0,
"maxWireVersion" : 9,
"readOnly" : false,
"ok" : 1
}
We should extract the server connection id and add it to our diagnostic output/summary information.