i have issue regarding publishing collection. have model of each document in collection.
{ "_id" : "8swmmomhtredndqtn", "persons" : [ { "userid" : "29pr753gmydxqzzo6", "lastreadtime":"" }, { "userid" : "gwkbykiqsfzdctwkz", "lastreadtime":"" } ] }
now want publish document persons.userid have current user id
here publish code
meteor.publish("chatrooms", function(){ return userdata.find({persons:{$elemmatch:{userid:this.userid}}}); });
but is nothing
i had try below code
meteor.publish("chatrooms", function(){ return userdata.find({"persons.userid":this.userid}); });
but getting result data 0
how can publish way?
Comments
Post a Comment