2014-03-05 29 views
0

我需要如下图所示使用meteorjs。我做了一个样本插入查询来收集并获得当过执行插入query.Please看到下面的代码和错误的错误,并建议我该怎么办?将值插入流星JS中的集合问题?

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"); 
    }     
}); 
+0

你可以改一下这个问题吗?我无法解析这个。什么是错误? –

+0

曾经执行时,提示以下错误插入查询将走进sewrver console.Error:未找到方法[404] @基督教弗里茨 – user3214030

+1

你在客户端和服务器端定义您的收藏? 'hcare_users =新Meteor.Collection( 'hcare_users')' –

回答

-1
hcare_users.insert({ 
        userid: userid, 
        firstname : firstname, 
        lastname : lastname, 
        bday: bday, 
        bmonth : bmonth, 
        byear : byear, 

         }); 

这是所有代码:

当执行下面插入查询,我得到这个错误?我想你错过了什么。 或者你可以使用浏览器的调试模式来检查的JavaScript什么错误;如果您使用chrome,则使用 。你可以调用ctrl + shift + i来查看控制台区域。 检查JS上的错误信息。

+0

请一次看到上面的代码,并建议我吗?@时间保障 – user3214030

+0

这不是一个答案。您应该对此进行评论。 –

+0

如果我可以评论问题,我会的。 – TimeGuard