|
For SelectMany in subobjects, driver generate wrong unwind query
We have 2 objects:
public class Mention
|
{
|
[BsonRepresentation(BsonType.ObjectId)]
|
public string Id { get; set; }
|
|
public RelatedData Related { get; set; }
|
}
|
|
public class RelatedData
|
{
|
public List<int> Players { get; set; }
|
public List<int> Clubs { get; set; }
|
}
|
And we have query:
_context.For<Mention>().AsQueryable()
|
.Where(...)
|
.SelectMany(x => x.Related.Players)
|
.ToList()
|
For this query driver generate :
{ "$match" : { .... } },
|
{ "$unwind" : "$Players" } <--- must be "$Related.Players"
|
|
|