Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to query for entries with columns that are not null with JavaScript Sequelize?

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.

The post How to query for entries with columns that are not null with JavaScript Sequelize? appeared first on The Web Dev.



This post first appeared on The Web Dev, please read the originial post: here

Share the post

How to query for entries with columns that are not null with JavaScript Sequelize?

×

Subscribe to The Web Dev

Get updates delivered right to your inbox!

Thank you for your subscription

×