To query for entries with columns that are not null with JavaScript Sequelize, we use the Op.ne
property.
For instance, we write
Post.update(
{
updatedAt: null,
},
{
where: {
deletedAt: {
[Op.ne]: null,
},
},
}
);
to select the entries that have the deletedAt
field set to a non-null value with Op.ne
.
And then we call update
with an object to set updatedAt
to null
for entries that match the condition.