Skip to content

Ability to add call-level parameters to hooks #303

@guillaumemach

Description

@guillaumemach

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:

  • Is there a way to do this from current version ?
  • If no would it be possible to add such feature ?

Thanks a lot !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions