1

我最近升级了我项目中的许多包,因为我这样做了,所以下面的查询现在失败了:

query['where'] = { [Op.and]: [
        sequelize.where(Database.getInstance().getConnection().col('id'), '!=', jsonObject['id'] ),
        sequelize.where(Database.getInstance().getConnection().col('username'), jsonObject['username'])
]};
console.log('Check if username is unique...');
console.log(query);

结果是:

 Unhandled rejection Error: Invalid value Where {
   attribute: Col { col: 'id' },
   comparator: '=',
   logic: { [Symbol(not)]: 1563 } }
   attribute: Col { col: 'id' },

我也试过:

query['where'] = { [Op.and]: [
    sequelize.where(Database.getInstance().getConnection().col('id'), '!=', jsonObject['id'] ),
    sequelize.where(Database.getInstance().getConnection().col('username'), jsonObject['username'])
]};

虽然遵循 docs,但仍然导致错误:

Unhandled rejection Error: Invalid value Where { attribute: Col { col: 'id' }, comparator: '!=', logic: 1563 }
4

0 回答 0