我正在尝试在不同的集合上设置产品类别,但只有在 docpad.coffee 中定义的最后一个集合在尝试时才真正设置它
firstCollection: ->
@getCollection("html").findAllLive().on "add", (model) ->
model.setMeta({category: 'first'})
secondCollection: ->
@getCollection("html").findAllLive().on "add", (model) ->
model.setMeta({category: 'second'})
document.category
对于每个集合的所有文档,将是“第二”。
如何为集合中的每个文档单独设置相同的元数据?