如何从应用程序连接 MongoDb 数据库
定义参数
private static IMongoClient _client;
private static IMongoDatabase _database;
private static IMongoCollection< -collection class name- > _collection;
为参数指定值
_client = new MongoClient("mongodb://localhost:27017");
_database = _client.GetDatabase("database name here");
_collection = _database.GetCollection< -collection class name- >("collection name here");