d4ltr0n
d4ltr0n
PPrisma
Created by d4ltr0n on 8/6/2024 in #help-and-questions
What are the best practices for using Postgres array functions within a Prisma query?
I want to include cardinality("comments") AS "commentsCount" in my SELECT clause, but I'd prefer not to have to make the entire query raw. Is there some way to get around this? I'm imagining something like the following:
prismaService.posts.findMany({
select: {
primaryText: true,
createdAt: true,
'cardinality("comments") AS "commentsCount"'
}
})
prismaService.posts.findMany({
select: {
primaryText: true,
createdAt: true,
'cardinality("comments") AS "commentsCount"'
}
})
2 replies