在我的Sequelize模型中,我有这个模型
module.exports = function(sequelize, Sequelize) {
return sequelize.define('TradingPlan', {
id: {
primaryKey: true,
autoIncrement: true,
type: Sequelize.INTEGER
},
name:Sequelize.STRING,
symbol: Sequelize.STRING(10),
symbol_pair: Sequelize.STRING(10),
entry_type: Sequelize.STRING(10),
conditional_long_entry_point: Sequelize.DECIMAL(18,8),
conditional_short_entry_point: Sequelize.DECIMAL(18,8),
entry_price: Sequelize.DECIMAL(18,8),
entry_order_type: Sequelize.STRING(10),
pyramid_entry: Sequelize.BOOLEAN,
exchange: Sequelize.STRING(30),
notes: Sequelize.STRING, <----------This is the problem one
当我检索notes
表数据时,它输出为
[object Object]
然后,当我尝试编辑此表中的其中一个帖子时,由于它是一个对象,因此不会接受。即使以字符串形式输入。我通常输入This is a good note!
我收到的错误是这个
name: 'SequelizeValidationError',
errors:
[ ValidationErrorItem {
message: 'notes cannot be an array or an object',
type: 'string violation',
path: 'notes',
value: [Object],
origin: 'CORE',
instance: [Object],
validatorKey: 'not_a_string',
at Promise._settlePromiseFromHandler (C:\node\trade-
mentor\node_modules\bluebird\js\release\promise.js:517:31
)
我没有运气在谷歌上搜索,其他人看到了吗?
答案 0 :(得分:0)
我在Mysql中的数据类型错误,我的数据类型为Blob
,在进行了更多的阅读之后,我还在Sequelize中将数据类型更改为Text
。