出版商:
Meteor.publish('market', function(limit) {
let self = this;
Markets.find({}, {
limit: limit
}).observeChanges({
added: function(id, market){
self.added("market", id, market);
let country = findCountry(market);
self.added("countries", country._id, country);
}
});
return self.ready();
});
上面的发布者工作正常。我的问题是上述发布者发布market
和相关countries
光标。市场光标有限制。现在我想发布有限制的市场光标,并且应该无限制地运行observeChanges
。country
所以我写了像
Meteor.publish('market', function() {
let self = this;
let markets = Markets.find({}, {
limit: limit
});
Markets.find().observeChanges({
added: function(id, market) {
let country = findCountry(market);
self.added("countries", country._id, country);
}
});
return [self.ready(), markets]; // How to publish multiple cursors??
});
如何发布多个游标?