I'm trying to figure out how to conditionally send data to the client in meteor. I have two user types, and depending on the type of user, their interfaces on the client (and thus the data they require is different).
Lets say users are of type counselor
or student
. Every user document has something like role: 'counselor'
or role: 'student'
.
Students have student specific information like sessionsRemaining
and counselor
, and counselors have things like pricePerSession
, etc.
How would I make sure that Meteor.user()
on the client side has the information I need, and none extra? If I'm logged in as a student, Meteor.user()
should include sessionsRemaining
and counselor
, but not if I'm logged in as a counselor. I think what I may be searching for is conditional publications and subscriptions in meteor terms.