N1ql, join result no doc id


#1

I’m using n1ql to query data,
but i have some issues on n1ql with “left join”.

I need to query data with doc id
i know that we can use meta().id
but when my query like this:

SELECT * FROM dbs
LEFT NEST dbs listing_docs

we need to get listing_docs id too

SELECT *, meta().id FROM dbs
LEFT NEST dbs listing_docs

only get the first level id, but we need to get listing_docs’s id
but we can’t

how should we do?


#2
SELECT  dbs, ARRAY_AGG({listing_docs, META(listing_docs).id}) AS listing_docs
FROM dbs
LEFT JOIN dbs listing_docs ON KEYS .....
WHERE ......
GROUP BY dbs;