mongo connection status code example
Example 1: mongodb check connection status
> var status = db.serverStatus()
> status.connections
{"current" : 21, "available" : 15979}
>
Example 2: mongodb get status
db.runCommand( { serverStatus: 1 } )
> var status = db.serverStatus()
> status.connections
{"current" : 21, "available" : 15979}
>
db.runCommand( { serverStatus: 1 } )