Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meteor transactional operations

Tags:

meteor

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

like image 923
probably at the beach Avatar asked Feb 27 '13 06:02

probably at the beach


1 Answers

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

like image 197
Tarang Avatar answered Oct 11 '22 19:10

Tarang