I am running query select a from AppBucket
a where meta().id like ‘fmrt::%’ which output results as array of objects with data related to different ids like this
[
{
“a”:{
“x”:[ {“b”: “1”},“b”: “2”},“b”: “3”},“b”: “4”}],
“y”:“some data”
}
“a”:{
“x”:[ {“b”: “1”},“b”: “2”},“b”: “3”},“b”: “4”}],
“y”:“some data”
}
“a”:{
“x”:[ {“b”: “5”},“b”: “2”},“b”: “3”},“b”: “4”}],
“y”:“some data”
}
}
]
i need to get all the result which is b:5
Assuming an example document is:
{
"x":[
{"b":5},
{"b":1}
],
"y":"some data"
}
And any element in “x” could have b == 5, then:
SELECT a
FROM AppBucket a
WHERE meta().id LIKE 'fmrt::%'
AND ANY elem IN a.x SATISFIES elem.b = 5 END
If it must be the first element in “x” that has b == 5, then:
SELECT a
FROM AppBucket a
WHERE meta().id LIKE 'fmrt::%'
AND a.x[0].b = 5
HTH.
1 Like
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.