Reputation: 2733
Getting this error:
Error: Invalid value { [Symbol(col)]: 'user.profile_photo' }
With this Sequelize query:
const users = await db.users.findAll({
where: {
profile_photo: { [Op.ne]: null },
},
include: [
{
model: db.document,
where: {
path: {[Op.not]: [
{ [Op.col]: 'user.profile_photo' }
]},
}
}
],
});
I've also tried with users.profile_photo
.
I'm trying to not include users that have document.path
which equal user.profile_photo
. Is there an issue with the query construction?
Upvotes: 0
Views: 1176
Reputation: 2936
Try this:
path: {
[Op.not]: {
[Op.col]: 'users.profile_photo'
}
}
I know older version of sequelize would allow this:
path: {[Op.not]: '$users.profile_photo$'}
I have not tested this but it should be something like that or close.
Upvotes: 1