An alternative solution is to use Meteor.call('yourMethodName') (on the client).
Then on the server you can have
Meteor.methods({ yourMethodName: function() { } });
You might consider setting a session variable to the return value.
Meteor.call('yourMethodName', function (err, data) { if (!err) { Session.set('myData', data); } });
And then in some kind of template ...
Template.whatever.helpers({ messages: function() { return Session.get('myData'); } });
Why all this?
1) You can explicitly deny all direct `insert/update/find` queries from the client, and force usage of pre-defined Meteor methods. 2) You can manually determine when certain data is "refreshed".
Obviously, this methodology undermines the value of the subscription / publication model and should only be used when real-time data is not required.
Brad m
source share