jdgamble555
(Jonathan Gamble)
February 28, 2021, 6:36am
1
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
verneleem
(Verneleem)
February 28, 2021, 7:34am
2
Introspection would help you see the solution
mutation deleteTest($id: [String!]) {
deleteTest(filter: { name: { in: $id } }) {
msg
}
}
jdgamble555
(Jonathan Gamble)
February 28, 2021, 4:33pm
3
Thanks for the answer. However, I am getting this error:
[GraphQL] Field "in" is not defined by type StringTermFilter.
kaustubh
(Kaustubh Joshi)
February 28, 2021, 7:42pm
4
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