Reputation: 1654
I have a Replica Set, and i want to get rs.status() to analyze it.
How can i run commands like rs.status()
from C# driver ?
Upvotes: 5
Views: 2930
Reputation: 222521
I am not really familiar with C#, but you can use C#'s runCommand method, keeping in mind that rs.Status is a wrapper around replSetGetStatus database command. Which means you can run it with db.runCommand({ replSetGetStatus: 1 })
P.S. incorporating irmorteza's comment:
var database = mongoServer.GetDatabase("admin");
var res = database.RunCommand("replSetGetStatus");
Upvotes: 7