How is the n+1 problem solved with prisma? I trie...
# orm-help
l
How is the n+1 problem solved with prisma? I tried running a query:
Copy code
query {
  workspaces {
    id
    title
    workers {
      id
      name
    }
  }
}
Resolvers:
Copy code
{
  Query: {
    workspaces: (parent, args, ctx) => {
      return ctx.prisma.workspaces();
    }
  },
  Workspace: {
    workers: (parent, args, ctx) => {
      return ctx.prisma
        .workspace({
          id: parent.id
        })
        .workers();
    }
  }
}
But looking at the debug output it does'nt seem to solve the problem at all:
Copy code
Query:
{
  workspaces {
    id
    title
  }
}


Query:
query ($where: WorkspaceWhereUniqueInput!) {
  workspace(where: $where) {
    workers {
      id
      name
    }
  }
}

Variables:
{"where":{"id":"cjsd9u584000b07629ei22dpc"}}

Query:
query ($where: WorkspaceWhereUniqueInput!) {
  workspace(where: $where) {
    workers {
      id
      name
    }
  }
}

Variables:
{"where":{"id":"cjsdab6s8000p0762vxhtca4d"}}
Am i doing something wrong?
👍 1