halborg
10/31/2018, 10:03 AMtype User {
posts: [Post!]!
}
type Post {
id: ID! @unique
title: String!
}
type Comment {
id: ID! @unique
content: String!
author: User!
}
and a query of
{
users(first: 100) {
posts {
comments {
content
}
}
}
}
and a one-line Prisma resolver such as
resolve: async (parent, { first, after }, ctx, info) => {
return ctx.db.query.usersConnection({ first, after }, info),
}
(where db is of type Prisma in the generated schema)
it will fetch all of the posts, and all of the comments for each post for a 100 users, which is an obvious attack vector and a performance problem.
How do I resolve that in Prisma?
(forum post here: https://www.prisma.io/forum/t/how-to-limit-queries-on-nested-lists-with-prisma-bindings/4851)halborg
10/31/2018, 10:06 AM