我想检索除特定值以外的所有记录,我尝试了以下查询,但没有得到所需的输出。
db.owner.findAll({ exclude: { model : models.owner.name: 'jack'},
include: [{ model: models.customer, as: 'customers' }]
})
答案 0 :(得分:1)
此答案对我有用:
db.owner.findAll({
where: {name: { $not: 'jack'}},
include: [{ model: models.customer, as: 'customers' }]
});
答案 1 :(得分:0)
对此进行检查
db.owner.findAll({({
where : { name: {ne: 'jack'}},
include: [{ model: models.customer, as: 'customers' }]
});