How to get userinfo, by _id

use accounts-password

const article=article.findOne({_id:Template.instance().articleId});

article.art_auther is user _id

but

const user=Meteor.users.findOne(article.art_auther)

user is undefined

how to get userinfo, by _id

thanks :slight_smile:

You need to subscribe user data first.

Meteor.subscribe(‘users’);
but
undefined

Have you published the users on the server?

thanks for you help

but use
Meteor.publish(‘users’,function(){
return Meteor.users.find()
});
data is not safe

:grinning:

On the client, you have to wait until the subscription is ready.

:grinning:
i kown
but
other user password is public

You’re better off using a Meteor.method to get this sort of data from the server.
The only reason why you should subscribe to data is if you want it to be reactive.

1 Like

i`m try use meteor.methods()
but
meteor.methods() is async

next question