为了账号安全,请及时绑定邮箱和手机立即绑定

報這個錯,啥意思呀

2021-12-27 20:04:14,038 ERROR 17436  --- [LAPTOP-P3HRV5IH] - nodejs.SequelizeValidationError: string violation: title cannot be an array or an object

    at D:\linCMS\lin-cms-koa\node_modules\sequelize\lib\instance-validator.js:74:15

From previous event:

    at InstanceValidator._validate (D:\linCMS\lin-cms-koa\node_modules\sequelize\lib\instance-validator.js:72:8)

    at D:\linCMS\lin-cms-koa\node_modules\sequelize\lib\instance-validator.js:107:14

    at processImmediate (internal/timers.js:456:21)

From previous event:

    at InstanceValidator._validateAndRunHooks (D:\linCMS\lin-cms-koa\node_modules\sequelize\lib\instance-validator.js:106:8)

    at InstanceValidator.validate (D:\linCMS\lin-cms-koa\node_modules\sequelize\lib\instance-validator.js:90:38)

    at Movie.validate (D:\linCMS\lin-cms-koa\node_modules\sequelize\lib\model.js:4140:49)

    at D:\linCMS\lin-cms-koa\node_modules\sequelize\lib\model.js:3905:21

From previous event:

    at Movie.save (D:\linCMS\lin-cms-koa\node_modules\sequelize\lib\model.js:3902:23)

    at Function.create (D:\linCMS\lin-cms-koa\node_modules\sequelize\lib\model.js:2230:8)

    at Function.createMovie (D:\linCMS\lin-cms-koa\app\dao\/movie.js:7:29)

    at D:\linCMS\lin-cms-koa\app\api\v1\/content.js:21:18

    at processTicksAndRejections (internal/process/task_queues.js:97:5)

    at exports.log (D:\linCMS\lin-cms-koa\node_modules\lin-mizar\lin\middleware\log.js:15:9)

    at D:\linCMS\lin-cms-koa\node_modules\koa-mount\index.js:52:26

    at bodyParser (D:\linCMS\lin-cms-koa\node_modules\koa-bodyparser\index.js:95:5)

name: "SequelizeValidationError"

errors: [{"message":"title cannot be an array or an object","type":"string violation","path":"title","value":{"optional":false,"validateFunction":"isNotEmpty","message":"内容標題不能爲空","options":[],"rawValue":"都是死"},"origin":"CORE","instance":{"createTime":1640606654011,"updateTime":1640606654011,"id":null,"image":{"optional":false,"validateFunction":"isNotEmpty","message":"内容封面不能爲空","options":[],"rawValue":"http://www.baidu.com"},"type":{"optional":false,"validateFunction":"isNotEmpty","message":"内容類型不能爲空","options":[],"rawValue":"100"},"title":{"optional":false,"validateFunction":"isNotEmpty","message":"内容標題不能爲空","options":[],"rawValue":"都是死"},"pubdate":null,"status":{"optional":false,"validateFunction":"isNotEmpty","message":"内容有效狀態未指定","options":[],"rawValue":"1"},"update_time":"2021-12-27T12:04:14.011Z","create_time":"2021-12-27T12:04:14.011Z"},"validatorKey":"not_a_string","validatorName":null,"validatorArgs":[]}]

pid: 17436


正在回答

1 回答

初始化 title data 的类型不对,title 预期是一个字符串 类型,你定义成了对象。大概是这样。具体得看代码

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

举报

0/150
提交
取消

報這個錯,啥意思呀

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信