With the official C# driver you can query the value of the
MongoServer.State property, which will have one of the following
values:
public enum MongoServerState {
None = 0,
Disconnected,
Connecting,
Connected
}
Note that this value is not maintained in real time. It is current *as
of* the last operation performed against the server.
You can call MongoServer.Ping() to test whether the server is
reachable (which will also update the State property).