In my application I need to ensure that featureCompatibilityVersion
is no lower than the required value as part of the integration tests environment setup.
For that I would need to execute getParameter and setFeatureCompatibilityVersion admin commands.
Is there a way to do it using the .NET driver ? Was not able to find a way run using the MongoDB.Driver 2.4.4
The only approach I stumbled across was using the Server.RunAdminCommand
method, which appears to be obsolete.
You can use runCommand
to get parameter.
var client = new MongoClient();
var database = client.GetDatabase("admin");
BsonDocument parameter = database.RunCommand<BsonDocument>(BsonDocument.Parse("{ getParameter: 1, featureCompatibilityVersion: 1 }"));