I'm trying to update the subArray elements by the key, adding the value. I'm using the latest version of the library. In the new approach, the "AllMatchingElements" method is used. It seems like I'm doing everything according to the manual, but as a result of the execution, I get "Expression not supported" - what's the problem?
public async Task AddCupPass(Guid cupId, List<string> rank)
{
var u = Builders<CupStat>.Update.Inc(f => f.Winners.AllMatchingElements("winnerId").Value, 1);
var arrayFilterDefinitions = new List<ArrayFilterDefinition>();
arrayFilterDefinitions.Add(new BsonDocumentArrayFilterDefinition<CupStat>(new BsonDocument("winnerId.key", rank.First())));
await _cupStatColl.UpdateOneAsync(c => c.Id == cupId, u, new UpdateOptions
{
ArrayFilters = arrayFilterDefinitions,
});
}
public class CupStat
{
public Guid Id { get; set; }
public Dictionary<string, int> Winners { get; set; } = [];
}