Delete mutation @id field

How do I delete a field that is not an ID! but an @id field by the id field?

Schema

type Test  {
  name: String! @search @id
  task: String!
}

Mutation

mutation deleteTest($id: [String!]) {
  deleteTest(filter: { name: $id }) {
    msg
  }
}

Input

{
  name: [id]
}

I get this error:

[GraphQL] Variable type provided [String!] is incompatible with expected type 
StringTermFilter↵[GraphQL] Variable "$id" of type "[String!]" used in position 
expecting type "StringTermFilter".

It normally works with an ID! field, but deleting a String! @id is new to me…

Thanks,
J

Introspection would help you see the solution

mutation deleteTest($id: [String!]) {
  deleteTest(filter: { name: { in: $id } }) {
    msg
  }
}

Thanks for the answer. However, I am getting this error:

[GraphQL] Field "in" is not defined by type StringTermFilter.

Hey Jonathan. Try using the following :

Mutation

mutation deleteTest($custom_id: String!) {
  deleteTest(filter: {name: {allofterms: $custom_id}}) {
    msg
  }
}

Input

{
"custom_id" : "equivalent user name"
}
1 Like