how to check if a mongo client is still valid, i.e., it is still connected or active?

43 views
Skip to first unread message

Leo One

unread,
Jun 16, 2017, 8:12:51 PM6/16/17
to mongodb-user
See the subject

Rhys Campbell

unread,
Jun 17, 2017, 8:28:26 AM6/17/17
to mongodb-user

Kevin Adistambha

unread,
Jul 5, 2017, 9:16:54 PM7/5/17
to mongodb-user

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

Reply all
Reply to author
Forward
0 new messages