JackAdams / meteor-transactions

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

Specific undo/redo #9

Closed gcacars closed 9 years ago

gcacars commented 9 years ago

How can I undo or redo an specific transaction? Like: tx.undo({'_id':"vfXWyBZvZRCv29tT2"}); ?

JackAdams commented 9 years ago

Yes, good question. This is something that I've been planning but haven't implemented. The method will probably look more like tx.undo("vfXWyBZvZRCv29tT2");. I'll try to roll this out asap.

JackAdams commented 9 years ago

This functionality is now added (at least in the Github repo). I'll do some testing and then publish a new version of the package on atmosphere later today. Just pass a transaction _id value as the parameter to target a specific transaction. Currently not documented.

JackAdams commented 9 years ago

Okay, that's now published to atmosphere in the latest release.

gcacars commented 9 years ago

Wow! Thanks Jack, I do a fork from you: https://github.com/gcacars/meteor-transactions. Works great, but doesn't work with commits, only with normal tx.insert, tx.remove.... I try the new version from you. Thanks a lot man!

gcacars commented 9 years ago

Yeah! It works great!

JackAdams commented 9 years ago

Your code was very similar to mine, in the end. There were a few other subtleties to work out and some security implications to consider. In fact, because I was looking into the code, I noticed a bug in one of my security checks -- so thank you for prompting me to look into it! The whole package is better as a result.