Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- id title fruit
- 99 Avacados are the best! avacado
- ...
- const fruits = [
- 'avacado',
- 'banana',
- 'tomato',
- 'apple'
- ];
- const whereOrLike = fruits.map(fruit => ({
- title: {
- [Op.like]: `%${fruit}%`
- }
- }));
- const fruitData = await Fruit.findAll({
- where: {
- [Op.or]: whereOrLike
- },
- order: [['title', 'ASC']]
- });
Add Comment
Please, Sign In to add comment