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

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -