亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

Cannot read property 'call' of undefined,這個是怎么回事,查了好久,沒找到答案

Unhandled rejection TypeError: Cannot read property 'call' of undefined

? ? at D:\nodejs_scott\movieWeb\node_modules\mongoose\lib\query.js:2728:20


正在回答

2 回答

還是沒有看明白……

請問一下,在什么情況下會有您遇到的這個情況?

報這個錯誤Cannot read property 'call' of undefined

我在寫我自己的node項目的時候也遇到了這個問題

不知道從哪里差錯,也不知道哪里錯了。

0 回復 有任何疑惑可以回復我~

坑爹呀,找到問題了。。。


// admin post movie

app.post('/admin/movie/new',function(req,res){

//console.log('========'+ req.body+'\n'+"\n====================="+req.body.movie);

//console.log(req.body.movie.year);


var id = req.body.movie._id;

var movieObj = req.body.movie;

var _movie;


if (id !== 'undefined') {————————這里要加單引號?。?!


console.log(1);

Movie.fetch(id,function(err,movie){

if (err) {

console.log(err);

}


console.log(movie);

console.log(movieObj);

_movie = _.extend(movie,movieObj);


console.log(_movie);

_movie.save(function(err,movie){

if (err) {

console.log(err);

}


res.redirect('/movie/'+movie._id);

})

})

}

else{

console.log(2);

_movie = new Movie({

doctor:movieObj.doctor,

country:movieObj.country,

title:movieObj.title,

year:movieObj.year,

poster:movieObj.poster,

language:movieObj.language,

flash:movieObj.flash,

summary:movieObj.summary

});


console.log(_movie);


_movie.save(function(err,movie){

if (err) {

console.log(err);

}

console.log(movie._id);


res.redirect('/movie/'+movie._id);

})

}

})


0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
node+mongodb 建站攻略(一期)
  • 參與學習       91828    人
  • 解答問題       921    個

帶你完整實現一個從前端到后端的項目,初中級前端開發工程師必學課程

進入課程

Cannot read property 'call' of undefined,這個是怎么回事,查了好久,沒找到答案

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號