Best practice for publishing/subscribing to extra user fields


#1

What would be best practice for a global subscription that accessing extra fields on the user doc if they are logged in?


#2

See docs: http://docs.meteor.com/#/full/meteor_users


#3

If, by “global subscription”, you mean “automatic publish that doesn’t need subscribe”, then use:

// server
Meteor.publish(null, function () {
  if (this.userId) {
    return Meteor.users.find({_id: this.userId},
                             {fields: {'other': 1, 'things': 1}});
  } else {
    this.ready();
  }
});