Anish Anne
Anish Anne

Reputation: 193

Get current connections to MongoDB in Node.JS

How do I get the current amount of connections to my MongoDB collection?

Upvotes: 2

Views: 879

Answers (1)

Anders L
Anders L

Reputation: 67

Run this query:

db.serverStatus().connections

Should return a response containing the current, available, and total created connections.

More info in the official documentation: https://docs.mongodb.com/manual/reference/command/serverStatus/#connections

Upvotes: 1

Related Questions