Does anyone know how to limit the results of lists...
# orm-help
h
Does anyone know how to limit the results of lists in nested queries? For example, given the simple schema of
Copy code
type User {
  posts: [Post!]!
}

type Post {
  id: ID! @unique
  title: String!
}

type Comment {
  id: ID! @unique
  content: String!
  author: User!
}
and a query of
Copy code
{
  users(first: 100) {
    posts {
      comments {
        content
      }
    }
  }
}
and a one-line Prisma resolver such as
Copy code
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)
@nilan - You’ve helped me so much in the past year, and I’m so grateful. If you could help me with this one last thing as your ‘swan song’, I’d be so very happy! 😄