check mongodb service 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 } )