In MySQL (And other dbs), you can do a where in query with multiple columns like below:
SELECT * FROM trains WHERE (name, location) IN (('train1', 'us'), ... ,('train2', 'us'));
I'm trying to do this with sequelize:
const selectTrains = [
{name: 'train1', location: 'us'},
{name: 'train1', location: 'eu'},
{name: 'train2', location: 'us'},
];
let dbTrains = await Trains.findAll({ where: { [Op.in]: selectTrains} });
But I get the following error:
UnhandledPromiseRejectionWarning: Error: Invalid value {name: 'train1', location: 'us'}
The documentation didn't really cover this use case. Is this possible to do with the Op.in
operator?