// private static methods private static MongoClientSettings ParseConnectionString(string connectionString) { if (connectionString.StartsWith("mongodb://")) { var url = new MongoUrl(connectionString); return(MongoClientSettings.FromUrl(url)); } else { var builder = new MongoConnectionStringBuilder(connectionString); return(MongoClientSettings.FromConnectionStringBuilder(builder)); } }