Hello how do right syntax for ArrayFilter and var together ?
var pipeline = new[]
{
BsonDocument.Parse("{ $addFields : { m.$[e].MessageSeqMax: { $sum: ['$m.$[e].MessageSeqMax', 1] }} }"),
};
//-------------
ArrayFilters = new List<ArrayFilterDefinition<BsonValue>>
{
new BsonDocument("e.Id", new BsonDocument("$eq", id))
}
});
got error:
Unhandled exception. System.FormatException: Invalid JSON input ''.
at MongoDB.Bson.IO.JsonScanner.GetNextToken(JsonBuffer buffer)
------- Update 1 for those who dont know C# ------
Query:
{
"_id" : "8685316d-f26d-4f64-b72b-21fffd95b959",
"r" : { "$elemMatch" : { "rid" : "7349d79e-b34a-49f3-8a26-ad420a23878f" }
} ,
"update" : [
{ "$addFields" : { "r.$.MessageSeqMax" : { "$sum" : ["$r.$.MessageSeqMax", 1] } } }
]
Unhandled exception. MongoDB.Driver.MongoCommandException: Command findAndModify failed: Invalid $addFields :: caused by :: FieldPath field names may not start with ‘$’…