【发布时间】:2013-09-02 07:54:58
【问题描述】:
我收到了insert failed: Method not found 日志消息,这可能是这些线程中描述的结果:
- Meteor using a local connection results in error: insert failed: 404 -- Method not found
- Getting a error inserting in to a Meteor Collection
但是,我不知道如何。让我展示一下代码,希望能更清楚地解释。我正在使用 Coffeescript:
if Meteor.isClient
@VINs = new Meteor.Collection("vins")
scoped_vins = @VINs
Template.vins.events =
"click .icon-plus-sign": ->
console.log "this is #{this}"
realVIN = $("#your-vin").val().replace /\D/g, ''
console.log "user id is: #{Meteor.userId()} vin is #{parseInt(realVIN)}"
VINs.insert number: parseInt(realVIN), owner: Meteor.userId() if Meteor.userId()
$("#your-vin").val('')
else
@VINs = new Meteor.Collection("vins")
我完全是流星的 n00b,但我从上面引用的线程中收集到的是 collection 必须在客户端和服务器上可用。这不是我所做的,还是我患上了咖啡盲症?
谢谢!
【问题讨论】:
-
作为 n00b 的第一步是删除与重现错误无关的任何代码。例如。 VIN 上的
replace可能与错误无关,因此请尝试将其删除。错误是否仍然出现?继续删除代码,直到找出最小的复制案例。
标签: coffeescript meteor