Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Meteor订阅同一个集合2个不同的发布功能,在给定的时间只有一个作品_Meteor - Fatal编程技术网

Meteor订阅同一个集合2个不同的发布功能,在给定的时间只有一个作品

Meteor订阅同一个集合2个不同的发布功能,在给定的时间只有一个作品,meteor,Meteor,我有一个流星收藏 通道=新流星。收集“通道”;在“收藏”文件夹中 和2个发布功能channelsNames在侧栏导航中用于显示可用频道,当我转到频道设置时,我还使用channelSettings获取此特定频道的设置。铁制路由器 //Publish specfic channel settings Meteor.publish("channelSettings", function(channel){ check(channel, String); return channels.find

我有一个流星收藏

通道=新流星。收集“通道”;在“收藏”文件夹中

和2个发布功能channelsNames在侧栏导航中用于显示可用频道,当我转到频道设置时,我还使用channelSettings获取此特定频道的设置。铁制路由器

//Publish specfic channel settings
Meteor.publish("channelSettings", function(channel){
  check(channel, String);
  return channels.find({userId: this.userId, 'channels.name': channel}, {fields: {'channels.$': 1}} );
});

//Publish all connected channels names
Meteor.publish("channelsNames", function() {
  return channels.find({userId: this.userId, 'channels.name': {$exists: true}}, {fields: {'channels.name': 1}});
});
问题在于客户端您不能同时订阅这两个频道,只有当我在控制台频道中订阅时,才能在客户端集合上看到第一个订阅。findOne我可以验证我没有看到频道Name如果首先订阅了频道设置,则反之亦然

Meteor.subscribe('channelSettings', 'ebay');
Meteor.subscribe('channelsNames');
收藏看起来像这样

{
 _id:  2,
 userId: 123,
 channels: [ 
  {name: "channel1", inventorySync: false, inventoryMaxqty: 0, inventoryMinQty: 0},
  {name: "channel2", inventorySync: false, inventoryMaxqty: 0, inventoryMinQty: 0}
 ]
}

这是预期的行为吗?我认为meteor应该将两种数据合并到一个集合中。我该怎么做呢?

我很确定这是目前人们期望的行为。你不是第一个发现这种奇怪的人。这是预期的行为,因为合并框目前只在顶级字段上工作。更多细节,请参见和。是的,糟透了!我必须解决这个问题,我希望它已经得到支持。