I have a document collection with documents that look like the following
{
id: "123123541234"
items: [
{Name = "Item 1", Amount = 12.12},
{Name = "Item 2", Amount = 4.00},
]
}
I can write a sql self joined query like the following to return what I want:
select c.id, i.Name, i.Amount
from c
join i in c.items
As you can see, my doc with the id 123123541234 would be duplicated, once for each item in the nested array, so the output looks like:
[
{id = "123123541234", Name = "Item 1", Amount = 12.12 },
{id = "123123541234", Name = "Item 2", Amount = 4.00}
]
However, I'd like to use linq to write this query to keep my object references and type definition strong. I am failing to see how i can do this type of "flattening" via linq,
TL;DR: how do I do a self-join via linq to cosmosdb?