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
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
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
On the client, you have to wait until the subscription is ready.
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.