【发布时间】:2017-03-31 21:02:30
【问题描述】:
我是流星新手,我发现最好删除自动发布。 所以我尝试发布和订阅一个集合以获得两个不同的值。 在我的流星身边,我有:
Meteor.publish('channelUser',
function(){
var user = Meteor.users.findOne({
'_id':this.userId
});
console.log(user);
var test = Channels.find({
'_id': {$in : user.profile.channelIds}
});
return test;
}
);
Meteor.publish('channelToJoin',
function(){
var user = Meteor.users.findOne({
'_id':this.userId
});
console.log(user);
var test = Channels.find({'_id': {$nin: user.profile.channelIds}});
console.log(test);
return test;
});
在我的客户端中,我有第一个组件:
this.channelSub = MeteorObservable.subscribe('channelUser').subscribe();
this.channels = Channels.find({});
在第二个组件上:
Meteor.subscribe("channelToJoin");
this.channels = Channels.find({}).zone();
但在两个组件的客户端,我拥有相同的数据。 订阅中是否存在某种冲突?
我希望我能清楚地描述我的问题!
【问题讨论】:
标签: javascript angular meteor