The linq expression:
var list = collection.AsQueryable() .Where(city => city.Shops.Any(shop => shop.Name == "Shop 1" && shop.Books.Any(book => book.Pages.Any(page => page.Text == "page_1_1")))) .ToList();
Generated queries (from `CommandStartedEvent.ToJson()`)
v 2.7.3
aggregate - {
"aggregate": "cities",
"pipeline": [{
"$match": {
"Shops": {
"$elemMatch": {
"Name": "Shop 1",
"Books.Pages.Text": "page_1_1"
}
}
}
}
],
"cursor": {},
"$db": "test",
"lsid": {
"id": CSUUID("db90a3a1-e153-44a5-97dd-64660ba367f0")
}
}
v.2.8.0+
aggregate - {
"aggregate": "cities",
"pipeline": [{
"$match": {
"Shops": {
"$elemMatch": {
"Name": "Shop 1",
"Pages": {
"$elemMatch": {
"Text": "page_1_1"
}
}
}
}
}
}
],
"cursor": {},
"$db": "test",
"lsid": {
"id": CSUUID("01211669-37e4-4dd3-b838-6efe1a8043ed")
}
}
The `Books` element is missing in query generated by driver v2.8.0+, so it returns wrong result.
- related to
-
CSHARP-2744 Consider to restore(or modify) the previously removed logic or be sure that it doesn't cause a reason of wrong nested `Any`s
-
- Closed
-