JackAdams / meteor-transactions

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

Support update that replaces the whole document #83

Open mattmccutchen opened 7 years ago

mattmccutchen commented 7 years ago

This package could support update calls that replace the entire document, e.g., collection.update("myId", {a: 1, b: 2}).

The first thing to decide is how such an operation is represented in the transaction history. I have a prototype implementation, based on my prototype of #80, that represents it as a remove followed by an insert. This probably won't work with soft deletes. Alternatively, we could add a new action type, "replace", and try to add support for it in undo and redo without duplicating a ton of code. :/