Would it possible to have an N1QL which would return a result set ( still maintaining same hierarchy ) considering only Active nodes
Result set if we do not pass any status in query will be same as above
However if status is passed as “ACTIVE” then response would look like
Select whole document and reconstruct ARRAY with required info then alias with original name ( In object field names are unique, Projection alias overwrites previous one when used by (.*), NOTE: Explicit duplicate alias in projection is not allowed).
SELECT b.*,
ARRAY v FOR v IN b.childs WHEN v.status != "INACTIVE" END AS childs
FROM mybucket AS b
WHERE .....;
Thanks @vsr1 query works for first level of childs but isn’t working for second or levels beneath that , was trying this
SELECT b.*,ARRAY v FOR v WITHIN {childs} WHEN v.childs IS NOT MISSING END and v.status!= “INACTIVE” AS childs FROM bucket AS b USE KEYS “787483743863653756”