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

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

Error: Your pre must have a next argument -- e.g., function (next, ...)

$ node app.js

127.0.0.1:8080

Error: Your pre must have a next argument -- e.g., function (next, ...)

? ? at _next (D:\node\cinema\node_modules\[email protected]@hooks-fixed\hooks.j

s:58:23)

? ? at fnWrapper (D:\node\cinema\node_modules\[email protected]@hooks-fixed\hoo

ks.js:190:8)

? ? at model.<anonymous> (D:\node\cinema\node_modules\[email protected]@mongoose\

lib\plugins\saveSubdocs.js:20:7)

? ? at _next (D:\node\cinema\node_modules\[email protected]@hooks-fixed\hooks.j

s:63:32)

? ? at fnWrapper (D:\node\cinema\node_modules\[email protected]@hooks-fixed\hoo

ks.js:190:8)

? ? at D:\node\cinema\node_modules\[email protected]@mongoose\lib\plugins\validat

eBeforeSave.js:33:13

? ? at D:\node\cinema\node_modules\[email protected]@kareem\index.js:131:16

? ? at _combinedTickCallback (internal/process/next_tick.js:73:7)

? ? at process._tickCallback (internal/process/next_tick.js:104:9)

events.js:160

? ? ? throw er; // Unhandled 'error' event

? ? ? ^


TypeError: Cannot read property '_id' of undefined

? ? at D:\node\cinema\app.js:132:34

? ? at D:\node\cinema\node_modules\[email protected]@mongoose\lib\model.js:4038:1

6

? ? at D:\node\cinema\node_modules\[email protected]@mongoose\lib\services\model\

applyHooks.js:175:17

? ? at _combinedTickCallback (internal/process/next_tick.js:73:7)

? ? at process._tickCallback (internal/process/next_tick.js:104:9)


正在回答

1 回答

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

var id = req.body.movie._id

var movieObj = req.body.movie

var _movie

?

if( id != 'undefined' ){

Movie.findById, function(err, movie){

if(err){

console.log(err)

}


_movie = _.extend(movie, movieObj)

_movie.save(function(err, movie){

if(err){

console.log(err)

}


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

})

}

}

else{

_movie = new Movie({

doctor: movieObj.doctor,

title: movieObj.title,

country: movieObj.country,

language: movieObj.language,

year: movieObj.year,

poster: movieObj.poster,

summary: movieObj.summary,

flash: movieObj.flash

})

_movie.save(function(err, movie){

if(err){

console.log(err)

}

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

})

}

})


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

舉報

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

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

進入課程

Error: Your pre must have a next argument -- e.g., function (next, ...)

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

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

幫助反饋 APP下載

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

公眾號

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