Meteor-Community-Packages / meteor-collection-hooks

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

Ability to add call-level parameters to hooks #303

Open guillaumemach opened 9 months ago

guillaumemach commented 9 months ago

Hi all,

I've been using this package for some time, Thanks for this very good work.

There are situations where I need to call a hook (let say the after.insert hook for this example, but it could be any of them), but I don't want to perform all the actions define in the hook. So far to do this conditional computation in the hook it seems I can only rely on the document passed.

What I would need is to be able to pass extra arguments to the insert/update/remove/upsert call, which I can use inside the hook to perform computation or not based on these.

For exemple something like : MyCollection.insert({}).callOptions({denormalize: false});

And then

MyCollection.after.insert(function(userId, doc, {denormalize}){
     if(denormalize) ...
})

So:

Thanks a lot !

github-actions[bot] commented 9 months ago

Thank you for submitting this issue!

We, the Members of Meteor Community Packages take every issue seriously. Our goal is to provide long-term lifecycles for packages and keep up with the newest changes in Meteor and the overall NodeJs/JavaScript ecosystem.

However, we contribute to these packages mostly in our free time. Therefore, we can't guarantee you issues to be solved within certain time.

If you think this issue is trivial to solve, don't hesitate to submit a pull request, too! We will accompany you in the process with reviews and hints on how to get development set up.

Please also consider sponsoring the maintainers of the package. If you don't know who is currently maintaining this package, just leave a comment and we'll let you know.