I am trying to do here "Use the return value of the Meteor method in the helper template" here , except for collections.
Essentially, I have something like this:
(server side)
Meteor.methods({
queryTest: function(selector) {
console.log("In server meteor method...");
return MyCollection.find(selector);
}
});
(client side)
Meteor.call('queryTest', {}, function(error, results) {
console.log("in queryTest client callback...");
queryResult = [];
results.forEach(function(result) {
});
Session.set("query-result", queryResult);
});
Template.query_test_template.helpers({
query_test_result: function() {
return Session.get("query-result");
}
});
The problem is that my callback (from Meteor.call) is not even called.
If I replaced the method with only "return" foo, then the call will be called. In addition, if I add ".fetch ()" to find, it also displays fine (but no longer reactive, which breaks everything else).
What gives? Why is the callback not used? I feel like I'm really close and just need the right spell ...
: , _ensureIndex , , , ( - ).
, /, , , , . , , "".
, , "" ( , ).
:
Meteor.subscribe('my-collection-query', Session.get("my-collection-query-filter"));
. Templates.body.onCreate. , - (.. , ).
, , , . , , , , .
. , "" " ", .
. , - .