I am making a web application through meteor, and recently I have set up a mongo database on it. I am now trying to display the documents through an each function with this code:
Template.body.helpers({
gameTabs: function(){
return PopularGames.find();
}
});
and then implementing it in the html with:
{{#each gameTabs}}
{{>popularGames}}
{{/each}}
It wont display the results, and when I check the chrome console, it appears that there are no documents in the database at all, even though my terminal where I am running the db says there are documents in it. Any help would be great!
Are you publishing the documents to the client? If you are just starting out, autopublish package might be helpful for you. You can add it using :
meteor add autopublish
Or try setting up the pub/subs as given here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.