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.
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 theclient
version of the hook when called is indeeddirect
and thus skipped but the server version of theWidgets.direct.insert
seems to get called just asWidgets.insert
and I cannot figure out how to get it to not call the above collection hook. And in reality theserver
version is all that really matters.It took rewriting the
insert
as a Meteor Method, which is fine, but myallow
anddeny
was tight and this was working (I believe) in previous versions of Meteor. Thedirect
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 thedirect
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.