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");
时间: 2024-10-18 10:13:42