I have 2 collections: TestPlans and Users
TestPlans has an array called "assigned" which contains user _ids.
Users has an avatarUrl string
I need to iterate over each testPlan and furthermore each assignedUser and grab an avatarUrl for that user:
Something like {{#each testPlan}} {{#each assignedUser}} {{avatarUrl}}
the helper for testPlans I have:
testPlan: function() {
var testPlans = TestPlans.find({}, { sort: {createdAt: -1}}).fetch();
return testPlans;
}
the helper for assignedUser I have:
assignedUser: function(){
var assignedUsers = TestPlans.findOne({_id: this._id}).assigned;
return assignedUsers;
}
I'm not sure how call the avatarUrl for each assignedUser though.
The query would be
Users.findOne({_id: thisUserId}).profile.avatarUrl;
Just not sure how to pass the userid exactly.
each...in: blazejs.org/guide/spacebars.html#Each-in - Mitar