在 Meteor JS 中向集合问题插入值



我需要使用 meteorjs 将查询插入到集合中。我做了一个如下所示的示例,并在执行插入查询时出现错误。请参阅下面的代码和错误,并建议我该怎么做?

执行以下插入查询时出现此错误:

Error: Method not found [404]
var userid = t.find('#userid').value
, firstname = t.find('#fname').value
, lastname = t.find('#lname').value
, bday = t.find('#bday').value
, bmonth = t.find('#bmonth').value
, byear = t.find('#byear').value;
hcare_users.insert({
    userid: userid, 
    firstname : firstname,
    lastname : lastname,
    bday: bday, 
    bmonth : bmonth,
    byear : byear
}, function( error, result) { 
    if ( error ) console.log ( "error ="+ error); //info about what went wrong
    if ( result ) {
        console.log ( "result="+result );//the _id of new object if successful
        $('input[type="text"]').val('');
        //$('input[type="radio"]').val('');
        //$('input[type="date"]').val('');
        alert("Sucessfully Created");
    }                   
});
hcare_users.insert({
                     userid: userid, 
                     firstname : firstname,
                     lastname : lastname,
                     bday: bday, 
                     bmonth : bmonth,
                     byear : byear,
                      });

这就是全部代码?我想你错过了一些东西。或者您可以使用浏览器的调试模式来检查 JavaScript 上的错误;如果您使用铬。可以调用 Ctrl+Shift+I 来查看控制台区域。检查 JS 上的错误消息。

最新更新