I have a simple function that goes like this:
getCurrentUserInfo: function (userId, reference) {
var scanUser = Meteor.users.find({"_id": userId}).fetch()[0];
return scanUser.reference;
}
When user the function like this:
getCurrentUserInfo(Meteor.userId(), "_id");
It gives me "undefined" result which I believe it is due to the string parameter "_id" because it works if I return scanUser._id
directly . I am not sure how to make it work. Any suggestion or related topic about it? Thank you.
[0]
at the end of my query would remove the array property of scanUser but it did not so I have to usescanUser[reference]
and that sorted it out. :)