流星:插入失败:找不到方法 [英] Meteor: insert failed: Method not found
问题描述
我收到 insert failed:Method not found
日志消息,它可能是这些线程中描述的结果:
- Meteor使用本地连接导致错误:insert failed:404 - 找不到方法
- 在插入Meteor集合时遇到错误
ul>
但是,我没有看到怎么样。让我展示希望的代码,将更清楚地解释。我使用Coffeescript:
如果Meteor.isClient
@VINs = new Meteor.Collection(vins)
scoped_vins = @VINs
Template.vins.events =
click .icon-plus-sign: - >
console.logthis is#{this}
realVIN = $(#your-vin)。val()。replace / \D / g,''
console .loguser 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与流星,但我从上面引用的线程收集的是集合必须在客户端和服务器上可用。这不是我做的,还是我开发的Coffee-blindness?
谢谢!
在您的代码中 @VINs = new Meteor.Collection(vins)
在客户端和服务器,所以它可能是你把你的代码放入 / client
目录?
如果这样,这意味着代码只能在客户端上运行,即使您有 要修正此问题,请复制 I am receiving the However, I'm not seeing how. Let me show the code in hopes that will explain more clearly. I'm using Coffeescript: I'm totally a n00b with Meteor, but what I've gleaned from the above-cited threads is that the collection must be available on the client and the server. Is that not what I have done, or am I developing Coffee-blindness? Thanks! Make sure you've also declared your collection on the server as well as the client. In your code above If so this means that the code will only be run on the client, even though you have the To rectify this, copy the line you used into a
这篇关于流星:插入失败:找不到方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! else
您在
/ server
目录中使用 .coffee
文件:
@VINs = new Meteor.Collection(vins)
insert failed: Method not found
log message and it probably is the result of what is described in these threads:
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")
@VINs = new Meteor.Collection("vins")
in both the client and server so what it might be is that you've put your code into the /client
directory?else
for the if Meteor.isClient
block..coffee
file in the /server
directory:@VINs = new Meteor.Collection("vins")