CastError: Cast to Number failed for value "asdad"at path "year"오류
ValidationError: Movie validation failed
at MongooseError.ValidationError (/home/decade/code/test/node_modules/mongoose/lib/error/validation.js:22:11)
at model.Document.invalidate (/home/decade/code/test/node_modules/mongoose/lib/document.js:1410:32)
at model.Document.set (/home/decade/code/test/node_modules/mongoose/lib/document.js:695:10)
at model.Document.set (/home/decade/code/test/node_modules/mongoose/lib/document.js:540:18)
at model.Document (/home/decade/code/test/node_modules/mongoose/lib/document.js:66:10)
at model.Model (/home/decade/code/test/node_modules/mongoose/lib/model.js:41:12)
at new model (/home/decade/code/test/node_modules/mongoose/lib/model.js:3191:11)
at /home/decade/code/test/app.js:166:14
at Layer.handle [as handle_request] (/home/decade/code/test/node_modules/express/lib/router/layer.js:95:5)
at next (/home/decade/code/test/node_modules/express/lib/router/route.js:131:13)
at Route.dispatch (/home/decade/code/test/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/home/decade/code/test/node_modules/express/lib/router/layer.js:95:5)
at /home/decade/code/test/node_modules/express/lib/router/index.js:277:22
at Function.process_params (/home/decade/code/test/node_modules/express/lib/router/index.js:330:12)
at next (/home/decade/code/test/node_modules/express/lib/router/index.js:271:10)
at /home/decade/code/test/node_modules/body-parser/lib/read.js:129:5
message: 'Movie validation failed',
name: 'ValidationError',
errors:
{ year:
{ CastError: Cast to Number failed for value "asdad" at path "year"
at MongooseError.CastError (/home/decade/code/test/node_modules/mongoose/lib/error/cast.js:19:11)
at model.Document.set (/home/decade/code/test/node_modules/mongoose/lib/document.js:696:7)
at model.Document.set (/home/decade/code/test/node_modules/mongoose/lib/document.js:540:18)
at model.Document (/home/decade/code/test/node_modules/mongoose/lib/document.js:66:10)
at model.Model (/home/decade/code/test/node_modules/mongoose/lib/model.js:41:12)
at new model (/home/decade/code/test/node_modules/mongoose/lib/model.js:3191:11)
at /home/decade/code/test/app.js:166:14
at Layer.handle [as handle_request] (/home/decade/code/test/node_modules/express/lib/router/layer.js:95:5)
at next (/home/decade/code/test/node_modules/express/lib/router/route.js:131:13)
at Route.dispatch (/home/decade/code/test/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/home/decade/code/test/node_modules/express/lib/router/layer.js:95:5)
at /home/decade/code/test/node_modules/express/lib/router/index.js:277:22
at Function.process_params (/home/decade/code/test/node_modules/express/lib/router/index.js:330:12)
at next (/home/decade/code/test/node_modules/express/lib/router/index.js:271:10)
at /home/decade/code/test/node_modules/body-parser/lib/read.js:129:5
at invokeCallback (/home/decade/code/test/node_modules/body-parser/node_modules/raw-body/index.js:262:16)
message: 'Cast to Number failed for value "asdad" at path "year"',
name: 'CastError',
kind: 'Number',
value: 'asdad',
path: 'year',
reason: [Object] } } }
/home/decade/code/test/app.js:180
res.redirect('/movie/'+movie._id);
^
TypeError: Cannot read property '_id' of undefined
at /home/decade/code/test/app.js:180:35
at /home/decade/code/test/node_modules/mongoose/lib/document.js:1900:19
at handleError (/home/decade/code/test/node_modules/mongoose/node_modules/hooks-fixed/hooks.js:40:22)
at _next (/home/decade/code/test/node_modules/mongoose/node_modules/hooks-fixed/hooks.js:46:22)
at fnWrapper (/home/decade/code/test/node_modules/mongoose/node_modules/hooks-fixed/hooks.js:186:18)
at /home/decade/code/test/node_modules/mongoose/lib/schema.js:200:17
at /home/decade/code/test/node_modules/mongoose/node_modules/kareem/index.js:127:16
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
오류 보고 오류 원인 CastError: Cast to Number failed for value "asdad"at path "year"유형이 일치하지 않습니다. asdad는number형이 아닙니다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.