PostgreSQL json aggregation issue -
how postgres aggregation function merge 1 object element in array field in parent object.
what need
sector
project
result
my sql request.
select row_to_json(t) ( select id, data, ( select array_to_json(array_agg(row_to_json(p))) ( select id, data public."project" (s.data -» 'projectid') :: uuid = id ) p ) projects public."sector" s ) t;
it don't work, because projects null. need, unwind data field , merge projectid in data project table. unwind , lookup in mongodb.
Comments
Post a Comment