Reputation: 656
I'm having trouble with setting up a method to access data about my user collection.
What I want to do is to be able to build a list of user, visible to the currently logged in user, with a restrained access to their informations.
For that, I do :
// client side
{{#each talker}}
<div class="span5 talker-card well">
<span><b>{{talkname}}</b></span>
</div>
{{/each}}
if(Meteor.isClient){
Template.talkers.rendered = function(){
Deps.autorun(function(){
Meteor.subscribe("usersData");
});
};
Template.talkers.helpers({
talker: function(){
return Meteor.Users;
// return EJSON.stringify(Meteor.user());
// return [1, 2, 3, 4, 5, 6];
}
});
}
// Server side
if(Meteor.isServer){
Meteor.publish("usersData", function(){
return Meteor.users.find({}, {fields : {'profile.talkname' : 1}});
});
}
The problem is that absolutely nothing appears, the helper return nothing. I guess the problem is that I'm not getting the data from the good var client side, but I do not know in wuch one I can get them !
Can someone explain that to me ?
THanks you
Upvotes: 0
Views: 597
Reputation: 64342
The helper is returning Meteor.Users
which is a typo of a collection name, but not a cursor. Try Meteor.users.find()
instead.
Upvotes: 2