MongoClient _client;
IMongoDatabase _db;
MongoCredential credential = MongoCredential.CreateMongoCRCredential("pethome", "username", "pwd"); MongoClientSettings settings = new MongoClientSettings { Credentials = new List<MongoCredential>() {credential}, Server = new MongoServerAddress("ip") }; _client = new MongoClient(settings); _db = _client.GetDatabase("pethome");