[英]Delay on client side query - Meteor's Mongo Collections
我是流星新手,我正在客户端尝试一个简单的集合查询。 我在根目录的common.js文件中声明了Subject
集合,因此client/
和server/
文件夹中的文件都可以访问它。
问题:当我想通过drop
帮助器在我的home
模板中显示一些Subject
数据时,该数据会显示出来然后消失。 在帮助程序定义中使用console.log时,我看到数据按以下顺序显示,两次记录之间有大约20秒的延迟。
[]
[Object]
[]
[Object]
如果查询服务器,则结果是快速正确的。 我的对象看起来像:
{"_id":"b97SpxtduH2spqLXw","id":"15920","upd":"2013-12-29 04:42:16","uuid":"be81554a-7759-11e4-adb6-57ce06b062da","term_id":"9000","lang":"en","part_speech":"","gender":"","term":"Terminologia Morphologica","source":"","description":"","wiki":"","email":""}]
我已经将代码剥离给了我。 我有autopublish
程序包,但在客户端查询autopublish
不断出现此延迟。 当我在client.js内执行查询的简单console.log
,得到undefined
。
[Edit2:]流星删除udondan:bulk-collection-update完成了这项工作。 谢谢。 [编辑:]我尝试删除所有其他软件包,重新安装流星,并尝试使用其他浏览器(Chrome 39.0.2171.71(64位),Safari 8.0)。 我使用的是Yosemite OS X版本10.10.1。 根/ subject.html:
<template name="home">
{{#each drop}}
Smth {{this.term}}
{{/each}}
</template>
根/ common.js:
Subject = new Mongo.Collection("subject");
客户机/ client.js:
Template.home.helpers({
drop: function () {
var c = Subject.find({uuid: "be81554a-7759-11e4-adb6-57ce06b062da", lang: "en"}).fetch();
console.log(c);
return c;
}
});
我的流星包:
Users-MBP:subject user$ meteor list
accounts-github 1.0.2 Login service for Github accounts
accounts-google 1.0.2 Login service for Google accounts
accounts-twitter 1.0.2 Login service for Twitter accounts
accounts-ui 1.1.3 Simple templates to add login widgets ...
autopublish 1.0.1 Publish the entire database to all cli...
insecure 1.0.1 Allow all database writes by default
iron:router 1.0.3 Routing specifically designed for Meteor
meteor-platform 1.2.0 Include a standard set of Meteor packa...
nooitaf:semantic-ui 1.1.2 Semantic UI packaged for Meteor
udondan:bulk-collection-update 0.2.0 Bulk insert/update/delete documents in...
您的代码对我来说也很好。
meteor remove udondan:bulk-collection-update
删除批量收集更新包。 那有用吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.