Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Is there any way to have a Collection publish data in chunks on MeteorJS?

Is there any way to have a Collection publish data in chunks on MeteorJS?

Problem

Is there any way to have a Collection Publish data in chunks on MeteorJS? I've tried doing it through the .publish function but I'm not sure how to get it working.

I kept trying last night and ended up with something like this:

Meteor.publish('products',function(skip,limit){
    return Products.find({},{skip:skip || 0,limit:limit || 10});
});

I tried putting a Session variable on the subscriber to make it update the LiveData Set (I think it does that, not sure):

Meteor.subscribe("products",Session.get("skip"),Session.get("limit"));

After the session variable changed, nothing happened though, lol.

Problem courtesy of: Marz

Solution

You need to put your subscribe inside a Deps.autorun block.

Solution courtesy of: TimDog

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

Is there any way to have a Collection publish data in chunks on MeteorJS?

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×