Help with helper

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?

Are you using the autopublish package? If not, you need to subscribe to the partner.

Use a tool like msavin:mongol to see what documents you have available to you on the client, or simply do a Meteor.users.find().fetch() in console.

Yes autopublish is still enabled. In the end I got this code to work by adding the users email to their profile and then doing a find on profile.email: email. Not sure why emails.address wasn’t working.