mongodb check connection is open code example
Example: mongodb check connection status
> var status = db.serverStatus()
> status.connections
{"current" : 21, "available" : 15979}
>
> var status = db.serverStatus()
> status.connections
{"current" : 21, "available" : 15979}
>