gpt4 book ai didi

coffeescript - meteor :插入失败:找不到方法

转载 作者:行者123 更新时间:2023-12-03 10:38:04 25 4
gpt4 key购买 nike

我收到了 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")

    我完全是 Meteor 的 n00b,但我从上面引用的线程中收集到的是,该集合必须在客户端和服务器上可用。这不是我所做的,还是我正在发展咖啡盲症?

    谢谢!

    最佳答案

    确保您还在服务器和客户端上声明了您的集合。

    在您上面的代码中 @VINs = new Meteor.Collection("vins")在客户端和服务器中,所以可能是您已将代码放入 /client目录?

    如果是这样,这意味着代码将只在客户端上运行,即使您有 elseif Meteor.isClient堵塞。

    要纠正此问题,请将您使用的行复制到 .coffee 中。 /server 中的文件目录:

    @VINs = new Meteor.Collection("vins")

    关于coffeescript - meteor :插入失败:找不到方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18518449/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com