Include count of relations
How can I achieve the same this Prisma query does in Drizzle?
I'd like to include the number of posts the user has created in the result
I'd like to include the number of posts the user has created in the result
const result = await prisma.user.findUnique({
where: { id },
include: {
posts: {
select: {
_count: true
}
}
}
});