我只是在寻找一种使用提供的连接字符串初始化MongoClient
using的方法。MongoClientSettings
在项目网站上找不到任何这样的例子。这些都是他们的例子:
// To directly connect to a single MongoDB server
// (this will not auto-discover the primary even if it's a member of a replica set)
var client = new MongoClient();
// or use a connection string
var client = new MongoClient("mongodb://localhost:27017");
// or, to connect to a replica set, with auto-discovery of the primary, supply a seed list of members
var client = new MongoClient("mongodb://localhost:27017,localhost:27018,localhost:27019");