DEV Community

Nagarajan R
Nagarajan R

Posted on

Answer: Check the current number of connections to MongoDb

connect to the admin database and run db.serverStatus():

> var status = db.serverStatus()
> status.connections
   {"current" : 21, "available" : 15979}
> 

You can directly get by querying

db.serverStatus().connections

To understand what does MongoDb's db.serverStatus().connections response mean, read the documentation here.

connections

"connections" : {
   "current" : <num>,

Top comments (0)