public void ShutdownServer()
{
try
{
AdminCommand("shutdown");
}
catch (MongoException ex)
{
//this is the desired path
if (ex.Message.Equals("Server connection failed"))
return; //server should be down
}
throw new MongoException("ShutdownServer failed");
}