如何使用流星订阅的数据

问题描述:

我向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: ???, 

我如何通过道具Pass订阅数据?

Meteor.user()

Meteor.users.findOne(Meteor.userId())

+0

不要工作。它仅返回预定义的属性,如用户名和电子邮件。 – Dmitry

+0

'Meteor.users.findOne(Meteor.userId()) Object {_id:“Lm5LiXAt4pPFszHhC”,emails:Array [1]}' – Dmitry

+0

你是对的,但问题已经厌倦了发布代码,一些奇怪的原因 – Dmitry