Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

prisma graphql n+1 problem solution

const users = await prisma.user.findMany({})

const userIds = users.map((x) => x.id)

const posts = await prisma.post.findMany({
  where: {
    authorId: {
      in: userIds,
    },
  },
})
Source by www.prisma.io #
 
PREVIOUS NEXT
Tagged: #prisma #graphql #problem #solution
ADD COMMENT
Topic
Name
2+7 =