JackAdams / meteor-transactions

App level transactions for Meteor + Mongo
http://transactions.taonova.com/
MIT License
113 stars 16 forks source link

How to handle back to back updates? #56

Closed ericoe closed 8 years ago

ericoe commented 8 years ago

We've been using your package for months and we love it.

We have a problem where it is pretty easy for a user to use a combination of mouse/kb/toolbar etc and cause a "blur" event to fire at the same time as another update is happening.

In the easiest case... If I just call update 2 times in a row. Doing so throws a very cryptic error message: [Error: noCheck is not allowed by the schema] which is a non-sense error message. And neither update succeeds.

If I call 2 consecutive mongo updates... no problem. If I issue a tx update before a previous one has "completed" then I throw.

I'm hoping you can offer some advice about how to solve my problem where updates might happen in close succession from different parts of code.

Cards.update( {_id: id}, {$set: card}, { tx: true, context: {deckId: card.deckId, cardId: id} } );

ericoe commented 8 years ago

Disregard this question... I think I found my own problem. It looks like the "card" item was itself getting dirty between calls.