Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

prisma Return a relations count with include

const usersWithCount = await prisma.user.findMany({
  include: {
    _count: {
      select: { posts: true },
    },
  },
})
Source by www.prisma.io #
 
PREVIOUS NEXT
Tagged: #prisma #Return #relations #count #include
ADD COMMENT
Topic
Name
4+5 =