Meteor.publish - only emails.0.address


#1

I am currently publishing the user related details using the following code:

Meteor.publish('userData', function () {
  return Meteor.users.find({_id: this.userId}, {fields: {profile: 1, emails: 1}});
});

and subscribing using Meteor.subscribe(‘userData’);

After login to the app, and print Meteor.user() in chrome console, it prints all the details related to the user object - for example it publishes emails.0.verified. I dont want to publish the verification details.

I have tried the following which din’t work

Meteor.publish('userData', function () {
  return Meteor.users.find({_id: this.userId}, {fields: {profile: 1, emails.0.address: 1}});
});

I dont want to publish the verification details. Is this possible?


#2
{"emails.address":1}

#3

@Dan Thanks. I did this, but when I do Meteor.user() in the console - I can still see the verification details.

EDIT: Apart form {"emails.address":1} I also tried "emails.0.address":1 but with no success.


#4

I don’t think you can prevent the publication of the default fields.