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

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -