Config to use custom field in Users Collection
import {Accounts} from 'meteor/accounts-base';
// Add new custom field
Accounts.onCreateUser(function (options, user) {
user.profile = options.profile;
user.roleGroup = options.roleGroup;
return user;
});
-------
// public
// Customer field of users
Meteor.publish(null, function () {
if (!this.userId) {
return this.ready();
}
return Meteor.users.find({_id: this.userId}, {fields: {roleGroup: 1}});
});
---------
// Client
console.log(Meteor.user()); // can not get `roleGroup field`???