javascript - Issues with Meteor.users.findOne -
i'm working on application, wherein i've build out chat functionality.
i have limited way create conversations, during user creating it, , designated target user both have id's put conversation document within conversations collection.
im trying loop through array containing each of these id's, , upon finding id doesn't match current users, grab other users profile information.
otherusername: function(){ ( = 0; < this.users.length; i++ ) { if( this.users[i].id !== meteor.user()._id){ return( meteor.users.findone({ _id: this.users[i].id })); } } }
currently however, doesn't output anything. shows undefined.
any clue need name show up?
i have similar problem, on server side. when need user collection on client, have publish , subscribe it.
i have publication.js on server side with
meteor.publish("users", function () { return meteor.users.find(); });
and router.js in lib folder (for both client , server) with
router.configure({ layouttemplate: 'layout', loadingtemplate: 'loading', notfoundtemplate: 'notfound', waiton: function() { return [meteor.subscribe('events'), meteor.subscribe('users')]; } });
the users collection should accessible in client now. maybe try restrict publish function couple properties , not of them.
Comments
Post a Comment