Closed tapz closed 1 week ago
When I try to sort a json_agg array I get this error:
json_agg
eb.fn.jsonAgg(...).orderBy is not a function
eb.selectFrom('my_media as lsm') .where('sm.my_location_id', '=', eb.ref('sl.id')) .select( eb.fn.jsonAgg( jsonBuildObject({ ... }) ).orderBy('lsm.order_number') )
SELECT json_agg( jsonb_build_object( 'id', lsm.id, 'type', lsm.media_type, 'url', lsm.media_url, 'description', lsm.media_description ) ORDER BY lsm.order_number ASC ) FROM my_media lsm WHERE lsm.my_location_id = sl.id
Hey 👋
This is a yet-to-released feature.
When I try to sort a
json_agg
array I get this error:eb.fn.jsonAgg(...).orderBy is not a function