How to setup publish with subset of data in Meteor? -


i have large set of documents (1.7 million) in collection. setup meteor.publish in such way accepts argument/parameter returns minimal data set. e.g. argument search value front-end. possible pass arguments?

this have far.

//how pass front-end input in 'arg' here meteor.publish('postcodestopic', function(arg){     return postcodes.find({postcode: arg}); }); 

yes, can following:

server:

meteor.publish('postcodestopic', function(postcode) {   return postcodes.find({ postcode: postcode }); }); 

client:

var postcode = 03885; meteor.subscribe('postcodestopic', postcode); 

the format of subscribe meteor.subscribe(name, [arg1, arg2...], [callbacks]), arg1, arg2, etc. arguments meteor.publish(name, function(arg1, arg2...))


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -