Are multiple mutation in one request atomic?

mutation {
   mut1(...) {...}
   mut2(...) {...}
   ...
}

If I execute multiple mutations in the same request, assuming mut1 succeeds and mut2 fails, will the API roll back the changes made for mut1? So if one fails, all fail? Or will the changes from mut1 be kept?

From the GraphQL specification, if I understand correctly, mutations are executed sequentially, and there is no information in case of failures.

I did find that the Hasura GraphQL engine rolls back the changes, but I wanted to ask if this is also the case for Monday.

" If multiple mutations are part of the same request, they are executed sequentially in a single transaction. If any of the mutations fail, all the executed mutations will be rolled back."

Update: I tested a scenario where the first mutation succeeds and the second fails, and it seems Monday does not roll back the changes made by the first mutation.


The 1st mutation has a valid board ID, while the 2nd mutation has an invalid board ID.
Despite the response showing that an exception was thrown, by checking the UI, the 1st board’s name was changed.

  • Is this expected behavior?
  • Are there any directives or similar that I can include in the request to tell the API to roll back the changes on any failure?
1 Like

Hello there @EricM,

Would you be able to send us an email to appsupport@monday.com so that we can take a look into all of this from there?

Looking forward to hearing from you via email!

Cheers,
Matias

2 Likes

You are correct, the monday.com API is not transactional. You would need to manually roll back changes you want to revert on a partial failure.

2 Likes

I received a reply from the Monday team, and yes, the API is not transactional.
The behavior exhibited in the test case is because of static (types, structure) validations occurring before values are validated at runtime (‘board id’). The requests are executed sequentially (compatible with the spec GraphQL).

1 Like