我今天才开始使用流星,似乎无法弄清楚我做错了什么。我有一个在发布函数内部运行的查询,但是这个查询被另一个查询的结果过滤了。
简而言之,当我将文档添加到正在发布的数据库(CollectionTwo)时,它会按预期工作,但是当我在用于过滤的数据库(CollectionOne)中进行更改时,meteor 不会做出反应.
CollectionOne = new Meteor.Collection("one")
CollectionTwo = new Meteor.Collection("two")
Meteor.publish("items", ->
not_hidden = CollectionOne.find().fetch()
return CollectionTwo.find( _id: {'$in':( t.my_id for t in not_hidden )} )
)
同时,在客户端...
CollectionOne = new Meteor.Collection("one")
CollectionTwo = new Meteor.Collection("two")
Meteor.subscribe("items")
_.extend( Template.items,
items: ->
not_hidden = CollectionOne.find().fetch()
return CollectionTwo.find( _id: {'$in':( t.my_id for t in not_hidden )} )
)
任何想法可能是适当的解决方案?