Display the user's email via Meteor.userId()



I’m pretty new to Meteor development and I ran into a following problem.
I have my code wrapped within Meteor.methods. The owner: Meteor.userId() is currently displaying the id of the user who created the element. Is there a way to display user’s email instead of the unreadable ID generated by the server? And of course, what would be the best practice for doing it?

Here is my code:

    title: title,
    event_date: event_date,
    createdAt: new Date (), // grab the time object from the server
    owner: Meteor.userId()

Thanks a lot!


What you need to do is fetch the actual User from the database using the id and then use his email address from that collection.

The full command is

Meteor.users.findOne({_id: “4cgQpLGnugwcMgby7”}).emails[0].address


var userId = "Meteor.userId();
var user = Meteor.users.findOne({_id: userId});
return user.emails[0].address;



You can use the package publish-composite to publish multiple objects of one collection with children (1-1 mapping) of another collection.


Thanks, Stan. You solved my problem.