I have a couch database with documents (in a bucket called myBucket) each of whose structure is like so:
{
"id": 1234
"name": "Smith",
"properties": [
{
"address": 12,
"color": red
},
{
"address": 13,
"color": blue
},
{
"address": 9,
"color": red
}
]
}
So, as an example, I could make a call to retrieve a list of all names where the id field is 1234 like so:
"SELECT name FROM myBucket WHERE id = '1234'"
and this would return the array [“Smith”]
What query should I write in order to return a list of all the addresses where the id field is 1234 and the color member of the properties field is red?
So in this case I would like to return the array [12,9].
So I guess it would be something like:
SELECT properties.address FROM myBucket WHERE id = '1234'
well, this returns an array of 2 elements but each is an empty object.