Question

How to get the number of (open) MongoDB connections with the C# driver (1.9.0 NuGet package)?
MongoDB documentations describes that db.serverStatus() should give iformation about the count of open and available connections but I can't find any function in the C# driver which represents this information.
(Documentation of db.serverStatus(): http://docs.mongodb.org/manual/reference/command/serverStatus/ )

Was it helpful?

Solution

I searched my fork of the driver for serverStatus, there's no results, so currently, I don't think this command is supported.

There's no associated jira (with serverStatus, at least) that i can find

Adding this functionality would be fairly trivial I would think

Edit

I wrote on the mongodb driver google group, and got this reply from Craig at MongoDB inc.

You can simply run:

MongoDatabase adminDb = ...;

adminDb.RunCommand("serverStatus");

I believe this needs to be run on the admin database.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top