简体   繁体   中英

Getting a “method not found [404]” error from dev console while working with meteor collections

I am trying to insert a document into my meteor collection with an autoform made from my mongo schema, yet when I press the submit button it is giving me a "method not found [404]" error in the dev console. I believe it is coming from this code:

GameList.allow({
  insert: function(userId, doc){
    return !!userId;
  }
});

which allows people to add documents to the database if they are logged in as a user. Without this code I will receive a "not authorized [403]" error, because I took out the insecure package from my meteor app. Any idea on what is causing this method not found error?

Autoform code:

{{> quickForm collection="GameList" id="insertGameForm" type="insert" class="newGameForm"}}

Schema for autoform:

GameListSchema = new SimpleSchema({
  title: {
    type: String,
    label: "Title"
  },
  platform: {
    type: String,
    label: "Platform"
  },
  category: {
    type: String,
    label: "Category"
  },
  gameRank: {
    type: String,
    label: "GameRank"
  },
  auth: {
    type: String,
    label: "Author",
    autoValue: function(){
      return this.userId
    },
    autoform: {
      type: "hidden"
    }
  }
});

GameList.attachSchema(GameListSchema);

I believe this is happening because your allow/deny rules are supposed to run on the server according to the Meteor documentation. Try putting them on server-side code and running this again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM