Hi,
I’m using Meteor 1.3 to build an app which has a search mechanism. The search component uses a composer which subscribes to a subscription that applies the search criteria on the server, then the composer just does a find({}) to return everything.
However, repeated running of this search with different queries makes the collection return a cumulative set of all previous queries.
Is there ‘best practice’ for this type of thing?
Should I just apply the same selectors on both server and client so it only filters for what is needed, and let the collection just grow without clearing between queries until it’s next unmounted?
Should I run sub.stop() before resubscribing with the new query in the composer? If so, where is best to store the subscription handle? A file global? Pass it into the component to run stop() before the next query is submitted?
Or have I completely missed something terribly obvious because I’ve been staring at this problem for too long?
Thanks!