Using Postgres' JSON capabilities, we can create queries that will make you feel like you're using MongoDB. The inner select creates a result set that stores the newest 3 comments for every post in the main query. The aggregate function turns N rows into a real JSON array.

Post cover image
2 Impressions3 Comments