我是流星newb,我正在嘗試客戶端的簡單集合查詢。我在根中的common.js文件中聲明瞭Subject
集合,因此client/
和server/
文件夾中的文件都可以訪問它。客戶端查詢延遲 - 流星的Mongo集合
問題:當我想通過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
包,但我在客戶端查詢時一直得到這個延遲。當我在client.js中查詢一個簡單的console.log
時,我得到undefined
。
[編輯2:] meteor刪除udondan:bulk-collection-update完成了這項工作。謝謝。 [編輯]我嘗試刪除所有其他軟件包,重新安裝meteor,嘗試其他瀏覽器(Chrome 39.0.2171.71(64位),Safari 8.0)。我在優勝美地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...
我把你的代碼放入[meteorpad](http://meteorpad.com/pad/Mqq94E4EYCk6FJod6/Clientside%20find),它工作正常。我沒有添加你列出的軟件包,所以也許其中一個導致了這個問題。 – user728291 2014-12-06 07:51:01
正如我在編輯中所說:我嘗試刪除所有其他包,重新安裝流星,嘗試另一個瀏覽器(Chrome 39.0.2171.71(64位),Safari 8.0)。我在優勝美地OS X版本10.10.1上。 – 2014-12-06 08:51:02
是的,你是對的......似乎我總是使用批量收集更新軟件包(@Ron是正確的),即使我刪除了所有其他軟件。謝謝。 – 2014-12-06 09:03:53