Reputation: 771
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?
Upvotes: 2
Views: 286
Reputation: 64312
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}});
});
Upvotes: 4