0

我有一个集合,我也必须作为一个整体进行发布。现在的挑战是,一旦我作为一个整体出版,它就会压倒那些一次只返回5张的人。具有设置限制的发布是为了实现分页,而发布则全部进入下拉框。我如何发布一个集合,以便任何一个都不会覆盖另一个?多次发布集合流星js

这是部分发布。设置与发布为一体

Meteor.publish('allvalues', function() { 
    user = Meteor.users.findOne({_id:this.userId}) 
    if(user) { 
     if(user.emails[0].verified) { 
     return SchoolDb.find({userId: Meteor.userId()}); 
     } else { 
     throw new Meteor.Error('Not authorized'); 
     return false; 
     } 
    } 
}); 

回答

0

该如何流星发布 - 订阅的行为的5

Meteor.publish('userSchools', function (skipCount) { 
    check(skipCount, Number); 
    user = Meteor.users.findOne({_id:this.userId}) 
    if(user) { 
     if(user.emails[0].verified) { 
     return SchoolDb.find({userId: Meteor.userId()}, {limit: 5, skip: skipCount}); 
     } else { 
     throw new Meteor.Error('Not authorized'); 
     return false; 
     } 
    } 
}); 

的限制。您可以做的是将limitskipcount放入订阅集合中,以及您在部分订阅的模版内。