javascript - Iron router meteor to publish only one item in a collection -


how write publish method iron router gets subscribe on item in collection

meteor.publish('patients', function(){ return newpatient.find();  }); 

i have tried subscription on routes 1 item still subscribes items in collection figured had publish method. please help

you should add publisher takes id parameter:

meteor.publish('patient', function (patientid) {   check(patientid, string);   return newpatient.find(patientid); }); 

then on client, can subscribe this:

meteor.subscribe('patient', this.params._id); 

also see subscriptions section of ir guide more details.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -