New to meteor and programming in general. Trying to learn by doing so I am building an app for my wife and I to add baby names to a collection called BabyNames. I have buttons to like or dislike a name and template helpers that show both the list of liked and disliked.
Template.myNames.helpers({
'mynames': function(){
var userid = Meteor.userId();
return BabyNames.find({liked: userid});
},
'notmynames': function(){
var userid = Meteor.userId();
return BabyNames.find({disliked: userid});
}
});
So far so good. These do what I want. Next step was to add a form which allows the logged in user to enter the email address of their partner and then helpers to view the names liked/disliked by their partner.
Template.partnersNames.helpers({
'mynames': function(){
var email = Meteor.user().profile.partner;
console.log(email)
var user = Meteor.users.findOne({"emails.address": email});
var userid = user._id;
console.log(userid)
return BabyNames.find({liked: userid});
},
Sadly this second helper is not working. It is getting the partner email but not getting the user associated with that email. What am I missing?