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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -