import {Meteor} from 'meteor/meteor'
import {Mongo} from 'meteor/mongo'
import {check} from 'meteor/check'
export Tasks = new Mongo.Collection('tasks')
if Meteor.isServer
Meteor.publish "tasks", ->
Tasks.find {$or: [{private: {$ne: true}}, {owner: @userId}]}
Meteor.methods
'tasks.insert': (text) ->
t = text
check text, String
if !Meteor.userId()
throw new Meteor.Error "not-authorized"
Tasks.insert
text: text
createdAt: new Date()
owner: Meteor.userId()
username: Meteor.user().username
W20170629-11:51:05.779(-7)? (STDERR) /Users/lfdsf/.meteor/packages/meteor-tool/.1.5.0.edxpxb++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280
W20170629-11:51:05.780(-7)? (STDERR) throw(ex);
W20170629-11:51:05.780(-7)? (STDERR) ^
W20170629-11:51:05.781(-7)? (STDERR)
W20170629-11:51:05.781(-7)? (STDERR) ReferenceError: text is not defined
W20170629-11:51:05.782(-7)? (STDERR) at meteorInstall.imports.api.tasks.coffee.js (imports/api/tasks.coffee:13:7)
Why “text is not defined” error?
Meteor 1.5
Thanks