猿问

TypeError: Cannot read property '_id' of undefined建站攻略1期——编写数据库交互代码出错

TypeError: Cannot read property '_id' of undefined
   at D:\imooc\app.js:78:25
   at Layer.handle [as handle_request] (D:\imooc\node_modules\express\lib\router\layer.js:95:5)
   at next (D:\imooc\node_modules\express\lib\router\route.js:131:13)
   at Route.dispatch (D:\imooc\node_modules\express\lib\router\route.js:112:3)
   at Layer.handle [as handle_request] (D:\imooc\node_modules\express\lib\router\layer.js:95:5)
   at D:\imooc\node_modules\express\lib\router\index.js:277:22
   at Function.process_params (D:\imooc\node_modules\express\lib\router\index.js:330:12)
   at next (D:\imooc\node_modules\express\lib\router\index.js:271:10)
   at serveStatic (D:\imooc\node_modules\express\node_modules\serve-static\index.js:74:16)
   at Layer.handle [as handle_request] (D:\imooc\node_modules\express\lib\router\layer.js:95:5)
   at trim_prefix (D:\imooc\node_modules\express\lib\router\index.js:312:13)
   at D:\imooc\node_modules\express\lib\router\index.js:280:7
   at Function.process_params (D:\imooc\node_modules\express\lib\router\index.js:330:12)
   at next (D:\imooc\node_modules\express\lib\router\index.js:271:10)
   at D:\imooc\node_modules\body-parser\lib\read.js:129:5
   at invokeCallback (D:\imooc\node_modules\body-parser\node_modules\raw-body\index.js:262:16)

Micity
浏览 2166回答 4
4回答

一头飞奔的猪

把app代码po出来看看

风舞

这个问题你可以查查数据库里面有没有记录,按我的猜想,你这个估计数据库记录都没新增成功

我的女神

D:\imooc\app.js:78你的app.js文件里面有一个属性没有赋值导致的。你仔细看看D:\imooc\app.js这个文件.
随时随地看视频慕课网APP

相关分类

Node.js
我要回答