In my app, by default, I’m publishing all of the users first and last names, but don’t want to reveal any of their other information.
Meteor.publish(null, function() {
return Meteor.users.find({}, { fields: { 'profile.firstName': 1, 'profile.lastName': 1}});
});
At a later point in my app, once some criteria has been met, I want to publish the full user profile:
Meteor.publish('fullUserInfoWithId', function(id) {
var aDoc = Docs.find(id);
return Meteor.users.find({ _id: aDoc.userId }, { fields: { 'profile.street': 1, 'profile.city': 1, 'profile.state': 1}});
});
You can see in the second publish I’m trying to send the address info to the client.
This doesn’t seem to be merging with the existing mini-mongo data. Is there any way to do this with user data?
Edit One piece of information I forgot to include is that I’m publishing the email in that second publish:
{ fields: { emails: 1 }}
And the emails are getting sent to the client, so I know that publish is wired up. It’s just not merging or “joining” the profile data.