Use Methods for check user data proper?

If I just need to get user firstname, lastname by providing user ID, using Methods for this purpose is it proper?

I can’t imagine how to do this with Publish. Please advice.

It depends on your use case. I use methods when I dont need the data to be reactive, but you can also do it with publications if required.

On your publication just publish the user you need and then subscribe to that on UI.

Meteor.publish('users.byId', function userByIdPub({ userId }) {
  return Meteor.users.find({ _id: userId }, { fields: { 'profile.firstName': true, 'profile.lastName': true } });
});

Hope this helps.

1 Like

Thanks for the advice.