I've searched around to see if anybody needed this before but couldn't find much.
I have the following json objects in Azure DocumentDB collection:
{
personID: 1,
name: "Bruce",
surname: "Dickinson",
items: [
{
itemID: 1,
itemType: "A",
name: 'Item 1'
},
{
itemID: 2,
itemType: "A",
name: 'Item 2'
},
{
itemID: 3,
itemType: "B",
name: 'Item 3'
}
]
}
The collection has many Persons in it. personID 2, 3, 4 ......100....1000 and so on.
I would like to write a SQL query to extract an array of itemIDs for personID = 1 and items with itemType = 'A'. I want the result to look like this:
itemIDs: [
1,
2
]
or simply:
[
1,
2
]
Has anybody ever tried doing this before? Is it even possible?