javascript - Passing arguments in Meteor.subscribe -
when can pass argument when subscribing published collection?
i publishing collection this:
meteor.publish('recent-posts', function (options) { var limit = options.limit; return posts.find({}, {sort: {date: -1}, limit: limit}); }); in routes file, can pass {limit: 5} options this, , works:
... waiton: function () { return meteor.subscribe('recent-flights', {limit: 5}); } ... what confuses me works:
... waiton: function () { return meteor.subscribe('recent-posts', {date: this.params.date}); } ... the second example subscribes me posts date value.
why work? seems passing {date: this.params.date} options. have not defined date in meteor.publish.
nothing in meteor lead such behavior, @ least far can tell source code. tested example in "clean" meteor instance. did not behave describe. must in code doing this. be, aren't describing problem correctly.
i noticed in using 2 different subscriptions in example; recent-posts , recent-flights. might source of confusion.
Comments
Post a Comment