-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 2.4.4
-
Component/s: Read Operations
-
None
This code works great when I run it in a standard .NET Core console app:
Unable to find source-code formatter for language: csharp. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
collection.UpdateOne(
filter: Builders<Animal>.Filter.Where(x => x.Subdocument.Subarray.Any(itm => itm.SomeProperty == "foobar")),
update: Builders<Animal>.Update.Inc(x => x.Subdocument.Subarray[-1].SomeNumericProperty, 10)
);
But when I run that same console app in a Linux container on my Windows machine, I get this exception:
MongoBulkWriteException`1: A bulk write operation resulted in one or more errors. cannot use the part (Subarray of Subdocument.Subarray.−1.SomeNumericProperty) to traverse the element ({Subarray: [ /* All elements of Subarray listed here */ ]}) MongoDB.Driver.MongoCollectionImpl+<BulkWriteAsync>d__22.MoveNext() MongoWriteException: A write operation resulted in an error. cannot use the part (Subarray of Order.Subarray.−1.SomeNumericProperty) to traverse the element ({Items: [ /* All elements of Subarray listed here */ ]})
I've tried with simpler update expressions, like just set a property without any positional operator, and that works, so my conclusion is that it has something to do with the positional operator.