我有第一个尝试使用MongoDB.Driver从mongodb获取值的项目。我可以连接到数据库和"GetAll“,但是当提出需要ObjectId的请求时,我会收到这个例外:
Exception has occurred: CLR/System.IndexOutOfRangeExceptionAn exception of type 'System.IndexOutOfRangeException' occurred in MongoDB</
我学习了本教程,但是nuget包很旧,现在使用的是新包MongoDB.Driver ,所以语法不同,我可以通过元素进行修改。这是我到现在为止所得到的。List<Info> list = new List<Info>();
var server = new MongoClient(MongoUrl.Create("mongodb://localhost