我在Meteor应用的用户集合中向根添加了额外字段,无法通过反应访问它们。 这是出版物:
if (Meteor.isServer) {
// This code only runs on the server
Meteor.publish('currentUserInfo', () => {
if (!this.userId) {
return this.ready();
}
return Meteor.users.findOne({_id: this.userId});
}); }
这是订阅:
export default createContainer(()=>{
Meteor.subscribe('currentUserInfo');
return {
currentUser: ???,
如何通过道具传递订阅数据?
答案 0 :(得分:1)
Meteor.user()
或
Meteor.users.findOne(Meteor.userId())