Is there a way to exclude certain properties from client updates?
It should not be possible to see the property when inspecting a collection in the console
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Absolutely.
Remove the
autopublishpackage which is turned on by default:meteor remove autopublishCreate your collection:
Rooms = new Meteor.Collection("rooms");No conditional isServer or isClient needed, as this should be present to bothIn your server side code, publish only a subset of your collection by zeroing out the fields you don’t want the client to have:
NOTE: setting
{secretInfo: 0}above does not set all instances ofsecretInfofor every row in theRoomscollection to zero. It removes the field altogether from the clientside collection. Think of0as the off switch 🙂Subscribe client side to the published collection:
Hope this helps!