简体   繁体   English

为什么我的流星每个功能都不起作用?

[英]Why wont my meteor each function work?

I am making a web application through meteor, and recently I have set up a mongo database on it. 我正在通过流星制作一个Web应用程序,最近我已经在上面建立了一个mongo数据库。 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: 然后使用以下代码在html中实现:

{{#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. 它不会显示结果,并且当我检查chrome控制台时,即使我正在运行db的终端显示数据库中也没有文档,但看来数据库中根本没有文档。 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 或者尝试按此处给出的设置发布/订阅

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM