meteor-collection-hooks
meteor-collection-hooks copied to clipboard
Run specific hooks on demand
Is there currently a way to run some specific hook or set of hooks on demand?
Say I have a set of before update hooks on a collection. Most of the time I want them all to run. But on some operations that update multiple documents at once, for performance reasons, I would rather use the direct update, and then perform just one of the hooks on the changed documents.
By the way, thanks @matb33 for the fix on direct operations. It's working great now.
My current guess would be to define separate Meteor.Collection instances for each case where different hooks would be used, using the same database collection on each instance.
But maybe there is a better way?
@olivermaldonado good point, and interestingly that was the old behavior from a long time ago. I agree that it would be useful to have some way to have the hook fire on a per call basis, as opposed to per document.
The behavior would likely be specified as an option using the new options system