Meteor Subscribe to all pages


#1

When I do a search to mongodb in a page, the result shows in all pages of my site, that is, make a search on the page “search1”, i get a result. When I go to page “search2”, the result I got in “search1” s there. I want to clean all pages from past results. Here’s the example:
meteorpad - bequipamentos


#2

the solution to your problem is very simple, you have to stop somehow subscriptions

sub = Meteor.subscribe('search');

Template.search.onDestroyed(function () {
  sub && sub.stop();
});

as a recommendation, always be sure to stop subscriptions that you don’t need
(I speak Spanish, if you speak Spanish contact me by gmail luisito453@gmail.com if you need more help)


#3

It works, I´m from Portugal and always liked ours nuestros hermanos :slight_smile: Muchas gracias .