我有一個有以下功能發佈(使用的CoffeeScript)流星的應用程序後,重新運行:流星:發佈功能不插入一個項目
Meteor.publish "apps", ->
apps = Apps.find {},
fields :
name : 1
description : 1
icon : 1
fileIds = []
apps.forEach (doc, idx, cursor) ->
if (doc.icon)
fileIds.push(doc.icon)
console.log(fileIds)
files = Files.find {_id : { $in : fileIds}}
[apps, files]
注意我有它的console.log檢查當發佈功能運行時。 將元素插入到收集應用程序後。我沒有看到發佈功能重新運行。對我來說,問題在於Apps集合包含一個字段圖標,它是Files集合中一個項目的_id(使用CollectionFS)。當我將項目插入應用程序時,會上傳文件並將項目插入到Files集合中。但是,由於發佈功能未重新運行,因此新創建的File項目不會發布到客戶端,因此客戶端無法查看該文件。
這裏有什麼問題嗎?
謝謝。
[Meteor.publish:發佈集合取決於其他集合]的可能重複(http://stackoverflow.com/questions/26398952/meteor-publish-publish-collection-which-depends-on-other-collection) –