Partial Select - Child array

I have a one-many relationship of recipe->comments. How do I get it to return the comments as an array?

const test = await db
.select({
...getTableColumns(recipe),
comments: getTableColumns(comment), // This should be an array
})
.from(recipe)
.leftJoin(comment, eq(recipe.id, comment.recipeId));
Was this page helpful?