Hello Guys,
Just in case some masters there are still awake, I encountered problem when trying to control the subscription on client side. The objective is to subscribe only those data that are match with the terms I entered on a search field. So in my publication I have this way of implementation:
Meteor.publish("Customers", function(param, param1) {
let _project = (param) ? param : {};
let _clr = (param1) ? param1 : {};
console.log(_project);
return Customer.find(_project, _clr);
});
lets just focus on params
because that is the projection.
Now on my client side I put below codes on time when button is hit or clicked.
_subsc_Customers = Meteor.subscribe('Customers', _where, {limit : 100});
the _where
variable handle the condition for projection on my publication.
The codes doesn’t have error but it only works on first search (at the same time first subscription of course) then I change the search input field value to something i.e ‘testing’ and this time it doesn’t work. What I have to do is to reload the page and search the ‘testing’ keyword again and this time I got the result.
Any idea why this happened?
(The reason why I have to do this type of subscription is because we have thousands of records)
TY