Dynamically publications


I am developing an application that has a series of lists, each list containing either records from different collections or records form the same collection but with different query params.In Meteor, it seems as though you have to define these publications up-front and I don’t want to have to create publications whereby the lists could potentially require access to hundreads of thousands of records. So, is there a way to dynamically deifne publications or update the query params dynamically so that what is pulished is minimal?


You can pass your query parameters to your publication:

Meteor.publish('todos', function(params)


Meteor.subscribe('todos', Session.get('params');

Since session values are reactive, the subscription will be reprocessed every time ‘params’ changes.