有没有办法让集合在 MeteorJS 上以块的形式发布数据

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

本文关键字:布数据 数据 集合 MeteorJS 有没有      更新时间:2023-09-26

有没有办法让集合在MeteorJS上以块的形式发布数据?我尝试通过 .publish 函数执行此操作,但我不确定如何让它工作。

昨晚我一直在尝试,结果是这样的:

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

我尝试在订阅者上放置一个会话变量以使其更新 LiveData 集(我认为它这样做,不确定(:

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

会话变量更改后,什么也没发生,哈哈。

您需要将订阅放在 Deps.autorun 块中。