Marz
Marz

Reputation: 381

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? 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.

Upvotes: 0

Views: 144

Answers (1)

TimDog
TimDog

Reputation: 8928

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

Upvotes: 2

Related Questions