How to use the where function from sequelize
Find comprehensive JavaScript sequelize.where code examples handpicked from public code repositorys.
GitHub: Versayce/API-Project
57 58 59 60 61 62 63 64 65 66
include: [ {model: Review}, {model: SpotImage} ], where: { name: sequelize.where(sequelize.fn('LOWER', sequelize.col('name')), 'LIKE', '%' + searchValue + '%') } }) console.log('inside of searching route====================', searchSpots) let searchSpotsResults = [];
0
2
1
GitHub: bbueno96/clinica-api
20 21 22 23 24 25 26 27 28 29
? { ...where, [group.kind === 'OR' ? Op.or : Op.and]: group.items.reduce( (prev, f) => [ ...prev, sequelize.where(sequelize.col(f.name), { [comparerType[f.comparer || 'Equals']]: f.value, }), ], [],
0
0
1
+ 2 other calls in file
87 88 89 90 91 92 93 94 95
const itemsReduce = items.map(f => customFields[f.name] !== undefined ? sequelize.where(customFields[f.name][0], { [comparerType[f.comparer || 'Equals']]: f.value, }) : sequelize.where(sequelize.col(f.name), { [comparerType[f.comparer || 'Equals']]: f.value, }), )
0
0
1
+ 5 other calls in file
GitHub: daencis/e-monev
10 11 12 13 14 15 16 17 18 19
if(req.query.search && req.query.search !== null && req.query.search !== undefined && req.query.search !== ''){ search.push({'$id$': Sequelize.where( Sequelize.fn('LOWER', Sequelize.col('id')), 'LIKE', `%${req.query.search.toLowerCase()}%` )}) search.push({'$title$': Sequelize.where( Sequelize.fn('LOWER', Sequelize.col('title')), 'LIKE', `%${req.query.search.toLowerCase()}%` )}) search.push({'$code$': Sequelize.where(
0
0
1
+ 2 other calls in file
GitHub: daencis/e-monev
41 42 43 44 45 46 47 48 49 50
if(req.query.search && req.query.search !== null && req.query.search !== undefined && req.query.search !== ''){ search.push({'$id$': Sequelize.where( Sequelize.fn('LOWER', Sequelize.col('id')), 'LIKE', `%${req.query.search.toLowerCase()}%` )}) search.push({'$username$': Sequelize.where( Sequelize.fn('LOWER', Sequelize.col('username')), 'LIKE', `%${req.query.search.toLowerCase()}%` )}) search.push({'$name$': Sequelize.where(
0
0
1
+ 2 other calls in file
303 304 305 306 307 308 309 310 311 312
*/ async playerNameToXBoxId(playerName) { const name = playerName.toLowerCase(); const player = await this.Player.findOne({ where: { [Op.or]: [ sequelize.where(sequelize.fn('lower', sequelize.col('gamertag')), name), sequelize.where(sequelize.fn('lower', sequelize.col('nickname')), name), ] }, }); return player?.xboxId;
0
0
2
+ 39 other calls in file
40 41 42 43 44 45 46 47 48 49
exports.search = async (req, res) => { try { const users = await User.findAll({ where: { [sequelize.Op.or]: { namesConcated: sequelize.where( sequelize.fn( "concat", sequelize.col("firstName"), " ",
0
0
1
+ 4 other calls in file
75 76 77 78 79 80 81 82 83 84
cert_banner: path2, created_by: req.body.mt_user_id, status: 1, }; Halal_cert.findAll({ where: Sequelize.where( Sequelize.fn('lower', Sequelize.col('cert_name')), Sequelize.fn('lower', req.body.cert_name) ) })
0
0
1
+ 3 other calls in file
146 147 148 149 150 151 152 153 154 155
status: 1, }; const newName = req.body.br_product_name.trim(); Brand_product.findAll({ where: Sequelize.and( Sequelize.where( Sequelize.fn("lower", Sequelize.col("br_product_name")), Sequelize.fn("lower", newName) ), { status: 1 }
0
0
1
+ 3 other calls in file
GitHub: daencis/e-monev
12 13 14 15 16 17 18 19 20 21
if(req.query.search && req.query.search !== null && req.query.search !== undefined && req.query.search !== ''){ search.push({'$id$': Sequelize.where( Sequelize.fn('LOWER', Sequelize.col('data_master.id')), 'LIKE', `%${req.query.search.toLowerCase()}%` )}) search.push({'$description$': Sequelize.where( Sequelize.fn('LOWER', Sequelize.col('description')), 'LIKE', `%${req.query.search.toLowerCase()}%` )}) }
0
0
1
+ 3 other calls in file
GitHub: daencis/e-monev
16 17 18 19 20 21 22 23 24 25
)}) search.push({'$description$': Sequelize.where( Sequelize.fn('LOWER', Sequelize.col('description')), 'LIKE', `%${req.query.search.toLowerCase()}%` )}) search.push({'$program_description$': Sequelize.where( Sequelize.fn('LOWER', Sequelize.col('program_description')), 'LIKE', `%${req.query.search.toLowerCase()}%` )}) }
0
0
1
+ 2 other calls in file
52 53 54 55 56 57 58 59 60 61
pro_name: req.body.pro_name, pro_image:path, status:"1", }; Products.findAll({ where: sequelize.where( sequelize.fn('lower', sequelize.col('pro_name')), sequelize.fn('lower', req.body.pro_name) ) })
0
0
1
+ 3 other calls in file
sequelize.col is the most popular function in sequelize (1002 examples)