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 我是否可以将订阅存储在与服务器上命名不同的集合中_Meteor - Fatal编程技术网

Meteor 我是否可以将订阅存储在与服务器上命名不同的集合中

Meteor 我是否可以将订阅存储在与服务器上命名不同的集合中,meteor,Meteor,是否有方法将同一服务器集合的订阅存储在不同的minimongo集合中 如果没有,是否有任何最佳实践可供参考 我有一个汇总表,其中有50k个数据集,文档中有很多细节 // Server var collection = new Meteor.Collection("collection"); Meteor.publish("detail", function (id) { return collection.find({_id: id}); }); // A pager that does

是否有方法将同一服务器集合的订阅存储在不同的minimongo集合中

如果没有,是否有任何最佳实践可供参考

我有一个汇总表,其中有50k个数据集,文档中有很多细节

// Server
var collection = new Meteor.Collection("collection");
Meteor.publish("detail", function (id) {
   return collection.find({_id: id});
});
// A pager that does not include the data (fields:{data:0})
Meteor.publish("master", function (filter, sort, skip, limit) {
   return collection.find({name: new RegExp("^" + filter + "|\\s" + filter, "i")},
                          {limit: limit, 
                           skip: skip, 
                           sort: options, 
                           fields: {data: 0}
                          });
});

// Client
var collection = new Meteor.Collection("collection");
Deps.autorun(function () {
  Meteor.subscribe("master",
      Session.get("search"),
      Session.get("sort"),
      Session.get("skip"),
      Session.get("limit")
  );
  Meteor.subscribe("detail", Session.get("selection"));
});
上面的问题:两个订阅都馈送到同一个集合中

如果查找结果存储在同一个本地集合中,则此操作不起作用

拥有一个名为订阅/发布的本地集合将非常棒

// Client
var detail = new Meteor.Collection("detail"),
   master = new Meteor.Collection("master");

有什么想法可以鼓励订阅使用我自己的收藏吗?

我通过Andrews Hint的帮助找到了解决方案,这本书展示了许多发布订阅场景

无论如何:阅读之后,我发现我要问的问题在Meteor文档中也得到了回答

最后一个示例基本上为“messages”集合创建一个虚拟集合“counts”。做得好;-)


“Wer lesen kann Is im Vorteil!”

我通过Andrews Hint的帮助找到了解决方案,这本书展示了许多出版订阅场景

无论如何:阅读之后,我发现我要问的问题在Meteor文档中也得到了回答

最后一个示例基本上为“messages”集合创建一个虚拟集合“counts”。做得好;-)

“Wer lesen kann Is im Vorteil!”

发现流星一书在第13.5章详细讨论了这一点。我会考虑检查它。发现陨石书在第13.5章中详细讨论了这一点。我会考虑核实一下。