Use `getTableColumns` with `groupBy`

I am doing a nested query and postgres is requiring that every column I select be in the group by, can I use the method getTableColumns in the groupBy, I've tried just calling the method and destructing. No luck, the error reads "must have a Symbol.iterator method that returns an iterator"
2 Replies
Angelelz
Angelelz12mo ago
Yes, it's expecting an array. This is a workaround:
.groupBy(Object.values(getTableColumns(yourTable)))
.groupBy(Object.values(getTableColumns(yourTable)))
bambam22
bambam22OP12mo ago
Oh thanks!
Want results from more Discord servers?
Add your server