I am receiving the insert failed: Method not found
log message and it probably is the result of what is described in these threads:
- Meteor using a local connection results in error: insert failed: 404 -- Method not found
- Getting a error inserting in to a Meteor Collection
However, I'm not seeing how. Let me show the code in hopes that will explain more clearly. I'm using 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")
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!
replace
on the VIN probably has nothing to do with the error, so trying removing it. Does the error still occur? Keep removing code until you isolate the minimum reproduction case.