When a new account is created, i’m using the following code on the server to create a new field on a user document:
Accounts.onCreateUser(function(options, user) {
console.log('new user created')
user.custom = {
profileImg: 'kerbal.png'
}
return user;
});
Then, i’m publishing that custom field:
Meteor.publish('usercustom', function() {
return Meteor.users.find({
_id: this.userId
},
{
fields: {
profileImg: 1
}
});
})
In one of my templates onCreated, I subscribe to that data using Meteor.subscribe('usercustom')
.
Is something else needed? I am still unable to see my custom field in Mongol or access it in code. What am i missing?