We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prisma supports including the count of a relational field, so we should too.
const users = await prisma.user.findMany({ include: { _count: { select: { posts: true }, }, }, })
which returns an object like this
{ id: 1, email: 'alice@prisma.io', name: 'Alice', _count: { posts: 2 } }
Prisma also have support for filtering by the count of the relation, see https://www.prisma.io/docs/concepts/components/prisma-client/aggregation-grouping-summarizing#filter-the-relation-count
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Problem
Prisma supports including the count of a relational field, so we should too.
which returns an object like this
Prisma also have support for filtering by the count of the relation, see https://www.prisma.io/docs/concepts/components/prisma-client/aggregation-grouping-summarizing#filter-the-relation-count
The text was updated successfully, but these errors were encountered: