I know this question has been asked numerous times but I am having a difficult time publishing this information.
In Accounts.onCreateUser I am adding a field like so
{
...
user['info'] = { email: options.email, is_admin: false};
}
I publish this information;
Meteor.publish('user', function() {
return Meteor.users.find({}, { fields: { info: 1} });
}
and
Meteor.subscribe('user');
After debugging the Publish query returns the correct information but that is never given to the client when I try to access Meteor.user(). Do I have to do something else to allow info to be access by Meteor.user()?
Any suggestions?
You'll want to use null to publish to the single user.
Meteor.publish(null, function() {
return Meteor.users.find({_id: this.userId}, {fields: {info: 1}});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With