idempotent mutation
Hey folks, is there any way to make an idempotent mutation? I want to update a row documents based on the document_id (custom column), if not there, create a new one. Couldn't find anything in the docs, any hints?
4 Replies
You can do this the natural way: query the database for the row and use an if statement to create it if it does not exist, else update it.
Dang, is that simple?
that's awesome! Thanks Tom!
It's all in a transaction (assuming you're doing this logic in a Convex mutation function)
I am, yes!
Appreciate you Tom!