node.js - Sequelize 递减 JSON 列
问题描述
大家好,我正在使用 sequlize ORM,我正在尝试减少 JSONB 列
型号定义:
const condition = (sequelize, DataTypes) => sequelize.define(
'condition',
{
id: {
type: DataTypes.INTEGER,
autoIncrement: true,
primaryKey: true,
},
value: {
type: DataTypes.ENUM,
values: ['YES', 'NO'],
},
typeId: {
type: DataTypes.INTEGER,
},
position: {
type: DataTypes.JSONB,
defaultValue: {
row: 1,
col: 1,
},
},
},
{
paranoid: true,
timestamps: true,
},
);
我一直在使用以下查询:
Model.decrement(
"position.row",
{
by: 2,
where: {
'position.row': { [Op.gt]: 2 },
TypeId: 2,
},
},
);
但我得到了错误
错误:列“position.row”不存在
有谁知道我该如何解决这个问题?
解决方案
推荐阅读
- c# - 除了回显传入消息之外,有没有办法让 tcp 服务器发送响应?
- python - 将 python 烧瓶与 firebase 存储一起使用时,在烧瓶视图/函数中而不是在 firebase 中管理安全规则是否安全?
- visual-studio - 如何使用 Visual Studio 宏在 CMake 生成的 Visual Studio C++ 项目中设置输出和中间目录?
- tabulator - 如何知道 Tabulator 表格行是否已扩展?
- java - 在java中递归创建线程
- bitcoin - 来自地层协议的“前一个块的哈希”
- c++ - 在 Opengl 中实现查看相机点的最佳方法
- pdf - PDF 文件链接问题 - 我可以链接到同一文件中的不同页面吗?
- javascript - Excel 喜欢使用 react-data-grid 和 primereact 多选进行过滤
- python - 熊猫时间转换和经过时间