Postgres Aggregate Into Array In Javascript Interview