Navigate back to the homepage

Node sequelize where or query example

Infinitbility
Node, Sequelize
June 30th, 2021 · 1 min read

Hello Friends,

Welcome To Infinitbility!

This article based on where or query in node sequelize, here you will get example of where or query.

Sequelize provide operator functionality to manage this types of query.

For using operator you have to import op from sequelize like below.

1const { Op } = require("sequelize");

For using or condition we have to Op.or in where condition like below example.

1const { Op } = require("sequelize");
2Post.findAll({
3 where: {
4 [Op.or]: [
5 { authorId: 12 },
6 { authorId: 13 }
7 ]
8 }
9});

Where or query output

1// SELECT * FROM post WHERE authorId = 12 OR authorId = 13;

Thanks for reading…

Follow me on Twitter

Join our email list and get notified about new content

No worries, I respect your privacy and I will never abuse your email.

Every week, on Tuesday, you will receive a list of free tutorials I made during the week (I write one every day) and news on other training products I create.

Looking For React Native Tutorial?

we are trying to create the best Tutorial for react native developers.

When you want a daily updates about React Native Tutorial or infinitbility update subscribe to our newsletter.

Read React Native Tutorial

Request New Tutorial or Article on mail [email protected]

Guide book

Guidebook: The Javascript Monorepo Photoshop Guide

Tutorials

Categories

More articles from Infinitbility

How to detect video finished in video react

Video react onEnded example

June 29th, 2021 · 1 min read

React Native Functional Component Example

Functional Component Example

June 27th, 2021 · 1 min read
© 2020–2022 Infinitbility
About
Link to $https://medium.com/infinitbilityLink to $https://www.facebook.com/InfinitbilityLink to $https://github.com/infinitbilityLink to $https://twitter.com/infinitbilityLink to $https://www.buymeacoffee.com/infinitbilityLink to $mailto:[email protected]