the mutations are usually like this: ``` retur...
# orm-help
m
the mutations are usually like this:
Copy code
return prisma.mutation.createPost(
      {
        data: {
          ...args.data,
          author: {
            connect: {
              id: args.data.author,
            },
          },
        },
      },
      info,
    )
n
Hi @mark, thanks for the reply. I tried that and below is the error I received. My understanding is I would need the
data
key for updates, not for inserts.
Copy code
{
  "data": null,
  "errors": [
    {
      "message": "Variable '$data' expected value of type 'GameCreateInput!' but got: {\"data\":{\"playerOne\":{\"connect\":{\"id\":\"cjrb7hmij003s0894h2t8l326\"}},\"board\":\"[[]]\"}}. Reason: 'data' Field 'data' is not defined in the input type 'GameCreateInput'. (line 1, column 11):\nmutation ($data: GameCreateInput!) {\n          ^",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "createGame"
      ]
    }
  ]
}
Resolver:
Copy code
async function createGame(parent, args, context, info) {
  const game = await context.prisma.createGame({
    data: {
      playerOne: { connect: { id: args.userId } },
      board: "[[]]"
    }
  })
  return game
}
My original mutation was creating a Game object, but there were no connections to that object, which is where I'm confused.
@mark thanks for your reply. I've now narrowed down my issue a little. I can create a graphQL query to send to the prisma api that will accomplish what I need. My issue is with the prisma client and it not doing what I expect it to. I'll keep debugging, but just wanted to say thanks for the help.
m
omit de $ before data?
n