Meteor-Community-Packages / meteor-collection-hooks

Meteor Collection Hooks
https://atmospherejs.com/matb33/collection-hooks
MIT License
657 stars 92 forks source link

stop before.find calls on update #176

Closed znewsham closed 8 years ago

znewsham commented 8 years ago

This feature was undesirable to us, I'm not sure if it's a bug or if update should really call the before.find handler.

Obviously ignore the changes to the package name

mizzao commented 8 years ago

I actually use this "feature" in https://github.com/mizzao/meteor-partitioner.

matb33 commented 8 years ago

I was going to ask you @mizzao exactly about this. I don't think I can merge this... @znewsham I truly appreciate this though. Could you still describe why it was a problem for you?

znewsham commented 8 years ago

@matb33 Its a little complicated:

We are using collection-hooks to sync with a remote MS SQL DB. On after.update we push to the SQL db. On before.find we pull from the SQL DB (both databases are actively being used)

What was happening was that after the update (but before after.update) getDocs was triggering a before.find, which wiped out the changes in Mongo with the old data from SQL.