Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collection.direct not respected when called from client #238

Open
evolross opened this issue Feb 8, 2018 · 0 comments
Open

Collection.direct not respected when called from client #238

evolross opened this issue Feb 8, 2018 · 0 comments

Comments

@evolross
Copy link
Contributor

evolross commented Feb 8, 2018

I'm on Meteor 1.5.1. I have a collection defined in /collections (so server and client) with a hook like this:

Widgets.after.insert(function(userId, doc) {...};

On the client in a template click event I have the following:

Widgets.direct.insert({...});

No matter what I try, the direct is not honored if it's called from the client. I'm thinking maybe the client version of the hook when called is indeed direct and thus skipped but the server version of the Widgets.direct.insert seems to get called just as Widgets.insert and I cannot figure out how to get it to not call the above collection hook. And in reality the server version is all that really matters.

It took rewriting the insert as a Meteor Method, which is fine, but my allow and deny was tight and this was working (I believe) in previous versions of Meteor. The direct is respected when called from a Meteor Method and works as expected. The doc for this package says this should work in client, server, and between. Perhaps not the direct option though?

I tried looking through the code but it's too rich for my blood.

Overall not sure if this a bug or by design and/or if things work differently now that MDG guides you to no longer user allow, deny, and client-side inserts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant