-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 2.14.0
-
Component/s: LINQ3
-
None
-
Needed
-
In LINQ2, you could use the magic number -1 to indicate use of the positional operator, but this no longer works in LINQ3. When calling UpdateOneAsync, UpdateManyAsync, and related operations, the following code works in LINQ2, but fails in LINQ3:
await collection.UpdateOneAsync(l => l.Id == another.Id && l.AnArrayMember.Any(l => l.Id == anArrayId),
Builders<ModelClass>.Update.Set(l => l.AnArrayMember.ElementAt(-1).Deleted, true));
In LINQ3 this fails with the error "Cannot create field '-1' in element [...]". In LINQ2 it successfully translated it into "AnArrayMember.$.Deleted" and the Set command completed fine.
- is duplicated by
-
CSHARP-2232 Add Support for $[] array operator
- Closed
- is related to
-
CSHARP-4618 Cannot find documentation on differences between LINQ2 and LINQ3 providers
- Backlog