meteor server side bulk database changes -
is there way in meteor bulk changes in published collections in server side?... updating/inserting hundreds or thousands records without each individual record being sent subscribers 1 one?
i pulling in periodically third party data , want gather updates or inserts in 1 pull 1 batch update clients receive 1 change package not thousands of mini-updates. doing 1 one creates big bottleneck in app atm.
if there no support in meteor atm should updates directly mongo , let meteor pick on next mongo poll?
// imagine mychanges array 1000 items mychanges.foreach(function(change){ // trigger sync clients immediately... 1000 times // practically hang server // want gather changes here instead mycollection.update({_id: change.docid}, change); }); // , trigger sync here instead
thanks, reio
depending on how complex application is, or how many publish calls have, acheived rolling own publish functions.
i.e. instead of
meteor.publish("mycollection", function() { return mycollection.find(); } );
create own publish / cursor , add hooks it.
meteor.publish("mycollection", function() { globalobserver = mycollection.find().observe({ added: function(item) { publication.added(item); } // , on });
your batch updates need interact publish function in way, causing stop , re-intialise observer once updates complete.
Comments
Post a Comment