2014-03-05 35 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