Meteor-Community-Packages / meteor-collection-hooks

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

Run both on ".before.insert() and before.update()" when I insert data in autoform??? #129

Closed thearabbit closed 9 years ago

thearabbit commented 9 years ago

I use collecion2, simple schema, auto form and collection-hook.

// Server
Customer.before.insert(function (userId, doc) {
    console.log('before insert');
});
Customer.before.update(function (userId, doc, fieldNames, modifier, options) {
    console.log('before update');
});

Collection-Hook run both in .before.insert() and before.update() when I insert data in autoform. Please help me.

goldylucks commented 9 years ago

I experience the same things with after.insert and after.update

matb33 commented 9 years ago

That simply means that one of those packages is running insert and then update. There's no magic going on as far as collection hooks go.

goldylucks commented 9 years ago

Maybe add this to documentation so future users won't ask the same?

sean-stanley commented 9 years ago

Another option is seeing if we can make this package cooperate with collection2 and/or autoform to optionally ignore hooks