json - array indexing in N1QL -
i ran query: select z data x unnest x.m2 y unnest y.country z;
on json document:
{ "data": { "country": [ { "name": "canada" }, { "name": "greece" } ] } }
and got result:
[ { "z": { "name": "canada" } }, { "z": { "name": "greece" } } ]
i want select first country name (canada) , tried doing this:
select z[0] data x unnest x.m2 y unnest y.country z;
but return empty results. idea how it?
ignoring m2, do:
select z data x unnest x.data y unnest y.country z limit 1;
Comments
Post a Comment