Multiple Nested Array Query with N1QL Help

Hi Guys

I was wondering if you could help me:

I have the following document:
{
“data”: {
“result”: “CONCEPT-IMPL-1 DEFAULT”
},
“rules”: [
{
“filter”: {
“country”: [“AA”,“AB”],
“dimesion”: [“1x1”,“2x2”],
“ostype”: [“Windows”]
},
“data”: {
“result”: “CONCEPT-IMPL-1 A”
}
},
{
“filter”: {
“country”: [“BB”,“BA”],
“dimesion”: [“2x2”,“3x3”],
“ostype”: [“Linux”]
},
“data”: {
“result”: “CONCEPT-IMPL-1 B”
}
}
]
}

Now I would like to query using all attributes withing filter.
So the following Query works:
SELECT t.data from test t
UNNEST rules r
WHERE ANY c WITHIN r.filter.country SATISFIES c IN [“AA”]
END

But when I try multiple ANY parameters I get a syntax error…
Here is the problematic query:
SELECT * from test t
UNNEST rules r
WHERE ANY c WITHIN r.filter.country SATISFIES c IN [“AA”]
AND ANY d WITHIN r.filter.dimension SATISFIES d IN [“1x1”]
END

ANyone got a clue, or a better way to do it ?

Thanks

Cybermedia

is mis-spellings, you should try this one

SELECT * 
  FROM test t
UNNEST rules r
 WHERE (ANY c WITHIN r.filter.country SATISFIES c IN ["AA"] END) 
  AND (ANY d WITHIN r.filter.dimesion SATISFIES d IN ["1x1"] END)

1 Like