我遵循了各方示例中的目录格式。我对项目所做的唯一修改是运行:
mrt remove autopublish.
/model.coffee
Goals = new Meteor.Collection("goals")
Goals.allow
insert: (userId, goal) -> true
update: (userId, goal, fields, modifier) -> true
remove: (userId, goal) -> true
/server/server.coffee
Meteor.publish "goals", ->
return Goals.find({})
/client/main.coffee
Meteor.subscribe "goals"
Template.main.goals = ->
Goals.find({}, {sort: {name: 1}})
但我收到以下错误:
Uncaught ReferenceError: Goals is not defined
奇怪的是,如果我将 "Goals = new Meteor.Collection("goals")" 添加到客户端脚本的顶部,我会收到以下错误:
There is already a collection named 'goals'