I want to update 3 meteor collections in a function but only if all three of the updates are successful. Otherwise I'd like to roll back. Is there a good pattern for doing this yet?
Thanks
meteor uses mongodb for its database backend which doesn't explicitly support transactions. But there is still a pattern you could use: http://docs.mongodb.org/manual/tutorial/perform-two-phase-commits/
Basically you just put a state value in each of your transactions and only mark them done when everything is complete
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With