//1b. kết nối MongoDBLocal thông qua StableAPI
public string MongoDBLocal_Connect_StableAPI()
{
// Replace <connection string> with your MongoDB deployment's connection string.
var settings = MongoClientSettings.FromConnectionString("mongodb://localhost:27017/?readPreference=primary&appname=MongoDB%20Compass&directConnection=true&ssl=false");
// Set the version of the Stable API on the client.
settings.ServerApi = new ServerApi(ServerApiVersion.V1);
var client = new MongoClient(settings);
return "ok";
}
0 Nhận xét