Closed alexedev closed 9 years ago
We experienced the same thing. There was a little discussion on the forum:
It seems that the hooks are not run inside the method call, which meteor uses internally when you do a raw insert on the client. To circumvent the problem, we wrap our insert call inside a meteor method.
So, ideally the hooks should be part of the 'native' meteor insert, update, etc. calls. But I guess this can only be done by altering the core. So I'm referencing this highly requested feature again. :wink:
I ended up putting the code in /server , because I do not care for latency compensation in my specific case.
The hooks aren't particularly smart -- they just run before/after your call to Collection.insert. If you execute Collection.insert on the client and the server, the hooks will get called twice: once on the client, once on the server.
If we call Collection.insert(smth) in .after.insert then that smth is inserted twice. This strange behavior happens only if .after.insert is accessible from both client and server.