I have added new field in user collection but when I access it in the client side Meteor.user().cart ( cart is my new field). Its undefined. How can expose new field (cart) so that it can be access in the client?
The easiest way is to add a null
publisher which will automatically send the data without the need for a subscription. Be sure to limit the fields to only the ones you need.
Meteor.publish(null, function() {
return Meteor.users.find(this.userId, {fields: {cart: 1}});
});
来源:https://stackoverflow.com/questions/29383464/meteorjs-users-collection-how-to-expose-new-field