Getting associated users


Say I have a collection of articles and I want to then output the name of the user who wrote that article what’s the correct way of doing this?

I tried adding a transform to the collection of ownerName like so:

user = Meteor.users.findOne({_id: this.userId})
if(user) { return; }
else { return ""; }

However this only works if the user with that id is in a subscription. I’m really hoping I don’t need to publish a subscription for all users just for this data (even with just restricted fields to the I don’t like it).

I also don’t want to de-normalise this and save the name alongside the article.

What am I missing here?


I believe you can use the {{username}} helper that comes automatically with the accounts package if you are using username and emails in the signup form.