說我有一個Meteor.user()
對象,看起來像這樣:尋找從Meteor.user()用戶名用戶名和它匹配不同的集合
{_id: "xxxxxxxx", username: "john"}
和我有不同的集合,被稱爲profiles
,即看起來是這樣的:
{_id: "yyyyyyy", username: "john", firstname: "John", lastname: "Doe", etc...}
很顯然,我能夠從Meteor.user().username
設置profiles
的username
財產。
然而,當我嘗試匹配客戶端上的這一信息:
import Profile form '../imports/api/profiles'
Template.AddInfo.helpers({
interests(){
return Profile.find({username: Meteor.user().username});
}
});
,並在我的玉模板有這樣的代碼:
each interests
p #{username}
什麼也不顯示。
注:我也試過findOne({...})
以及相同的結果。
我在這裏做錯了什麼?在客戶端上處理Meteor.user()
的方式有問題嗎?
在此先感謝。
你是怎麼訂閱'Profile'集合的? – sonlexqt