How to add fields to the Meteor.users collection

前端 未结 2 447
星月不相逢
星月不相逢 2021-02-10 04:27

I want the Facebook accessToken that is stored in my user\'s document on the client. Following the meteor documentation, I should just add a new publish call.

In

相关标签:
2条回答
  • 2021-02-10 04:49

    you should use "fields" keyword

    Meteor.users.find({ _id: this.userId },
        { fields: { the-extra-fields-that-you-want-go-here: 1 } }
    );
    

    http://docs.meteor.com/#fieldspecifiers

    0 讨论(0)
  • 2021-02-10 05:09

    You can publish the field you want:

    Meteor.publish( null, function() {
      Meteor.users.find({}, {fields: {profile: 1, username: 1, ...}})
    }
    
    0 讨论(0)
提交回复
热议问题