-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.1
-
Component/s: None
-
None
-
Environment:WIndows 10 x64 FR
Visual Studio 2015, .NET 4.5.2
Driver has been compiled from the latest source in github (git master (49ecd1630d2aa4e634e86e4dc88731ae4f77f400))
When using the Aggregate method like this:
var aggregate = collection.Aggregate() .Match(p => p.Id == entityId) .Unwind<Entity, SubEntity>(p => p.SubEntities) .OfType<SubEntityA>() .Match(s => s.A == aValue); aggregate = aggregate.SortBy(i => i.A); var cursor = await aggregate.ToCursorAsync().ConfigureAwait(false);
the generated query isn't correct. The output is:
[{ "$match" : { "_id" : "1" } }, { "$unwind" : "$SubEntities" }, { "$match" : { "_t" : "SubEntityA" } }, { "$match" : { "A" : "A12" } }, { "$sort" : { "A" : 1 } }]
but should be:
[{ "$match" : { "_id" : "1" } }, { "$unwind" : "$SubEntities" }, { "$match" : { "SubEntities._t" : "SubEntityA" } }, { "$match" : { "SubEntities.A" : "A12" } }, { "$sort" : { "SubEntities.A" : 1 } }]
- related to
-
CSHARP-1430 LINQ OfType uses wrong projector when the current projector is a field.
- Closed