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 ?
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");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With