Home > Enterprise >  Extension methods for BsonDocument in C# from MongoDB 2.17
Extension methods for BsonDocument in C# from MongoDB 2.17

Time:09-01

In previous version of MongoDB driver there were some extension methods that doesn't exists anymore. I found alternatives for some of them, but this one is tricky for me:

Response()

Does anyone know how to fix this one? I went through documentation but I don't have previous experience with Mongo in general.

I want to fix this line:

MongoDbManager.GetDatabase(federatedDBKey).RunCommand(cmdDoc).Response["result"].AsBsonArray.Select(row => row.AsBsonDocument).ToList();

CodePudding user response:

A modern driver uses indexer: GetDatabase(federatedDBKey).RunCommand(cmdDoc)["result"]

  • Related