Hello everyone, just looking for some guidance reg...
# orm-help
k
Hello everyone, just looking for some guidance regarding using Prisma + Nexus connection type, https://nexusjs.org/docs/plugins/connection. By any chance does anyone know how to correctly implement the resolver of a connection type? For example for a
users
should I just be returning ctx.db.users.findMany() ? Could this approach have repercussions in performance given that it would be fetching all records ? I'm just not sure what
return ctx.users.resolveForConnection(root, args, ctx, info)
means in the example.
k
I believe you’re correct, directly connecting a to a Prisma
findMany
will have some performance implications. I recommend implementing cursor-based pagination directly within the
findMany
which works really well with
Relay
, something like this:
Copy code
ctx.db.users.findMany({
  cursor: afterUuid ? { uuid: afterUuid } : undefined,
  take: first + 1,
  skip: afterUuid ? 1 : undefined,
})
👍 1
k
Will give it a shot. Thank you!