Error if query in mutation fails

Is there a way to have a mutation fail if the query part of the mutation doesn’t match.

I have some connections where all the nodes on the end of an edge should already exist.

I have a mutation where I query for exisiting nodes and make the connections to those, but currently if that node does not exist a new node is created.

I want the mutation to fail if the child node does not exist.



Figured it out.
Apply the mutation then check the response for the variable name.
If it created one then discard the transaction

In general, we use some function like “Array.prototype.length”.

Also you can use conditional upsert in “if” cases.


I will check it out.



1 Like