【发布时间】:2015-08-12 14:32:28
【问题描述】:
例如,我必须这样做:
Router.route('/threadList', {
waitOn: function () {
return Meteor.subscribe('threads', Meteor.userId);
},
data: function() {
threads = Threads.find();
_.each(threads, function(thread) {
_.each(thread.comments, function(commentId) {
Meteor.subscribe('comments', commentId);
})
})
}
我不知道如何在 Meteor 中做这种事情
【问题讨论】:
-
让订阅接受评论 ID 数组而不是单个 ID 不是更简单、更高效吗?然后你可以建立数组并且只订阅一次。
-
这个问题一直出现,并且在stackoverflow上已经有多个答案。你也可以阅读:discovermeteor.com/blog/reactive-joins-in-meteor
标签: meteor iron-router