I am using Meteor publications and subscription. I want to publish only the data I wanted to display in the UI.
I am using fields as options but it’s not working.
You are mixing inclusion and exclusion modifiers. Its written in the docs. The fix is to just not include the ‘inclusion’ fields: “user_id”, “name” and “profile_pic”. they will automatically be added if not explicitly excluded.
With one exception, it is not possible to mix inclusion and exclusion styles: the keys must either be all 1 or all 0. The exception is that you may specify _id: 0 in an inclusion specifier, which will leave _id out of the result object as well. However, such field specifiers can not be used with observeChanges, observe, cursors returned from a publish function, or cursors used in {{#each}} in a template. They may be used with fetch, findOne, forEach, and map.
@cloudspider@copleykj , is it required that every collection must have the mentioned fields i.e Every row in the collection must have the password, cover_image, email_status, source etc.
mixmatric, your code snipped does not reveal all what we need to help you. Please post at a minimum the whole Meteor.publish code block (server), plus the Meteor.subscribe code block (client). Nice indented code will also help. A JSON mongo document that you expect to qualify the find criteria would also help.
@mixmatric: is UserInfo a synonym for Meteor.users?
I think some of the confusion I’m having here is that I’ve assumed it’s not (i.e. it’s a completely separate collection), but others may be assuming it is.