Question : sequelize get where
Answered by : nuno-henriques-oed0mvo50vf4
// Example
const Tokens = db.define('tokens', { guid: { type: sequelize.STRING }
});
// The basics of Sequelize Get Where
Tokens.findAll({ where: { guid: 'guid12345' } }).then(tokens => { console.log(tokens); }).catch(err => console.log('error: ' + err));;
// is equal to >> SELECT * FROM Tokens WHERE guid = 'guid12345'
Source : https://sequelize.org/master/manual/model-querying-basics.html | Last Update : Mon, 01 Feb 21
Question : in in sequelize
Answered by : hungry-hippopotamus-hl6ckaubsx42
await Tag.findAll({ where: { id: { [Sequelize.Op.in]: [1, 2, 3, 4] } }
});
Source : https://stackoverflow.com/questions/24920427/sequelize-error-when-using-where-and-in-on-a-subarray | Last Update : Thu, 17 Dec 20