Du kan prøve under c# ved at bruge både BsonDocument
og json streng mulighed. Der er ingen linq-mulighed.
var filter = Builders<BsonDocument>.Filter.Empty;
var update = Builders<BsonDocument>.Update.Set("grades.$[elem].mean", 100);
var arrayFilter = new BsonDocumentArrayFilterDefinition<BsonDocument>(new BsonDocument("elem.grade", new BsonDocument("$gte", 85)));
var arrayFilter = new JsonArrayFilterDefinition<BsonDocument>("{ \"elem.grade\": { $gte: 85 } }");
var arrayFilters = new List<ArrayFilterDefinition> { arrayFilter };
var updateOptions = new UpdateOptions();
updateOptions.ArrayFilters = arrayFilters;
var result = collection.UpdateOne(filter, update, updateOptions);