Making Upserts for connected fields


I’m trying to perform a mutation and also update or create a relation.
Here is my graphql schema:

    type Mutation {
      createPlaylist(name: String!, tags: [String!]!): Playlist!

type Playlist {
  id: ID!
  name: String!
  songs: [Song!]!
  tags: [Tag!]!

type Tag {
  name: String!
  playlists: [Playlist!]!

and here is my resolver

function createPlaylist(root, { name, tags, channelsId }, context) {
  let tagUpsetArray = => ({
    where: {
      name: value
    create: {
      name: value

  return context.prisma.createPlaylist({
    tags: {
      upsert: tagUpsetArray

but I get an error:
Reason: 'tags.upsert' Field 'upsert' is not defined in the input type 'TagCreateManyWithoutPlaylistsInput'. (line 1, column 11):

Please, how can I fix this?
Thanks in anticipation.


Hi @Awebi
Did you check createPlaylist method in playground (localhost:4466)? Is there any upsert mutation?


@andreibacescu93 do you mean in the docs found in the playground?


Hi @Awebi
Yes. There is where you should check.


Hi @andreibacescu93, there is no upset mutation.
But the docs show definitions from my schema.graphql file not the prisma CRUD api


Hi @Awebi
If you want to know if upsert mutation is defined or not, check your prisma CRUD api, at localhost:4466 (default endpoint for prisma service). If it is not there you have to deploy your prisma models. Looks for more details in docs.


Hi @andreibacescu93
There is no upsert in the createPlaylist method. Any idea why that is?


Hi @Awebi
I gave a hint in my last replay (deploy your prisma models and check prisma docs)


Hi @andreibacescu93
I’ve deployed my prisma model, but it didn’t change anything.
There is also nothing about this in the docs.


Hi @Awebi
This is strange. Could you show us what prisma model did you deploy?


This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.