Returning data when doing a mutation trying to re-create record which was already created

Hi @tvvignesh,

I believe returning out the entry will not be the right solution. From your example, I noticed you are creating the same node with id 1234 again and again. But consider this for an example, a service that selects id based on a mechanism and due to some concurrent access, give same id to two different objects say usernames A and B. Now in this case, first mutation for username A will be success, but in second mutation, it will create a conflict. And Sending out the previously created object for the given id can set wrong expectation with API’s. I believe better way would be to check the numUids value. It specifies the number of Uids created for the mutation. Its a more concrete way to validate the success of mutation.

Can you share some more details. Because as per the implementation while using add mutation, if the id object already exist, we do send out already exist error.

1 Like