How Can I Publish The Same Collection Under Different Names In A Meteor App?
In my application I have a collection that is a list of videos, which bring only the videos of the authenticated user and would like to publish the same collection to bring the lat
Solution 1:
The Meteor livedata
package does some magic with collections & subscriptions when you return a Cursor in Meteor.publish(..)
.
Tom Coleman gave a good example of how you can bend Meteor to do what you are looking for here: In Meteor how can I publish one server side mongo collection under different names?
Essentially you should do as he suggested, either:-
- Call that internal
_publishCursor
function passing in yourPlayLists.find({})
cursor andlatestlists
as your subscription name.
-Or-
- Copy the
_publishCursor
function and put it into a package for reusability.
Both approaches would work and I'd favour the latter as I am always wary about calling internal functions as they are liable to change underneath you.
Post a Comment for "How Can I Publish The Same Collection Under Different Names In A Meteor App?"