Reputation: 120
In Sequelize I´m using findByPk but I also need to pass another condition
return dependencies.db.models.user.findByPk(userId, {
include: [
{
model: dependencies.db.models.userGroup,
required: false,
where: {
Time: null,
},
I know that 'options.where' is not supported for findByPk , however it is being used inside of a include. I couldn't find verification in the sequelize documentation that what I am doing is correct.
Upvotes: 3
Views: 10697
Reputation: 4444
return dependencies.db.models.user.findByPk(userId, {
include: [
{
model: dependencies.db.models.userGroup,
required: false,
where: {
Time: { [op.eq]:null }
},
Upvotes: 7