When you search, a meteorite registers the dependency for this template helper in the collection you found. Because of this dependency, meteor will call the template helper for each modification to the collection.
If you have not signed up yet, there is no data on the client copy of your Mongo collection. Only when the subscription is called will the meteor arrive with data from the server.
Thus, the method is called several times because the subscription continues to insert new documents into your local copy of the mongo collection, causing new calls to the template helper.
The best template for solving any problems that may arise is to subscribe to the helper and use the ready method on the documentation subscription. Ready also responds, so when all the data is ready, it will be changed to true, and the assistant will be called again.
Template.Panel.helpers({ items: function() { var ready = Meteor.subscribe('tweets').ready(); var days_tweets = Tweets.find(); return { data: days_tweets, ready: ready }; }); }
The template itself:
{{#with items}} {{#if ready}} {{#each data}} <p>item</p> {{/each}} {{else}} Show a spinner or whatever {{/if}} {{/with}}
Marco de jongh
source share