meteor-joins icon indicating copy to clipboard operation
meteor-joins copied to clipboard

Cannot join Meteor.users if not logged in

Open Torone opened this issue 7 years ago • 1 comments

Hi,

I have a collection called Messages and I'm trying to join it with Meteor.users to get the author name:

export const Messages = new Mongo.Collection('messages');

Messages.join(Meteor.users, '_author', 'author', ['profile']);

if (Meteor.isServer) {
  Meteor.publish('messages', function() {
    return Messages.find({}, {
      sort: { createdAt: -1 }
    });
  });
}

If I'm logged in I can see correctly the user name for my messages. If I logout I receive the following error:

Exception from Tracker recompute function:
TypeError: Cannot read property 'profile' of undefined

Torone avatar Jul 27 '17 10:07 Torone

Hi @Torone thanks for reporting issue, I'll check what's the problem and fix if possible

perak avatar Jul 28 '17 20:07 perak