CosmosDB Provider Support Any(condition) on Nested Collection by mapping to ARRAY_CONTAINS
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
i looked around for another issue on this..was pretty shocked i couldn't find it, maybe my lingo/terms are all wrong. #14762 seemed like a subcase of what i was execpting to find. #20441 is another special case...well it's Any() and i'm after Any(boolCondition)
given
```
public class OrderReleaseEvent
{
public string Href { get; set; }
}
public class Order
{
public string Number { get; set; }
public ICollection OrderReleaseEvents { get; set; } = new List();
}
var results = awai db.Orders
.Where(
o => o.OrderReleaseEvents.Any(
e => e.Href == "https://example.com/events/b8f39c16-23da-4cf7-a71d-de5c859d0484"
)
)
.ToListAsync();
```
should match a document like this
```
{
"Number": "00700-10935701",
"_etag": "\"0900e9f8-0000-0800-0000-657c888c0000\"",
"OrderReleaseEvents": [
{
"Href": "https://example.com/events/b8f39c16-23da-4cf7-a71d-de5c859d0484",
}
]
}
```
The provider should translate this query into
```
SELECT * FROM c
WHERE Array_contains(c.OrderReleaseEvents, {"Href" : "https://example.com/events/b8f39c16-23da-4cf7-a71d-de5c859d0484"}, true)
```
Contributor guide
Assessment
This issue has not been assessed yet.