Hello, I'm trying to count entities in a relation ...
# orm-help
y
Hello, I'm trying to count entities in a relation with Prisma 2.
Copy code
const users = await prisma.users.findMany({
  where: { id: session.userId },
  select: {
    id: true,
    name: true,
    posts: { count: true },
  },
})
Is it possible to do something like this?
r
Hey @Yann Pringault 👋 Currently this is a feature request in Prisma here. It would be great if you could 👍 on the request so that we can prioritize it properly. As a workaround, for this you would have to use a raw query via
prisma.queryRaw
y
Thanks for the answer @Ryan, I've just upvoted the feature request 🙂
👍 1