Hi
Could you elaborate on what you are trying to find out, e.g. are you trying to check if a connection is “active” as in doing an operation, is currently connected to the database, from the driver side or from the server side?
As Rhys has suggested, the db.currentOp() command lists currently running operation in the database, along with some information identifying the connection source. Please see currentOp output fields for more details regarding its output.
From the driver side, all drivers follow the Server Discovery and Monitoring Spec. The relevant section is Monitoring, where the spec describes how drivers should monitor connections to the database.
Best regards,
Kevin