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?
You can achieve the same thing with $or
:
const selectTrains = [
{name: 'train1', location: 'us'},
{name: 'train1', location: 'eu'},
{name: 'train2', location: 'us'},
];
Trains.findAll({ where: { $or : selectTrains} });
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
For some reasons, in my database, in a table column, I have some data with an absolute url like this :
"Numeric type overview>BIGINT" Hello pals, I had trying understanding for a long time but can't, please help me with examples of the different cases when mysql can handle BIGINTExamples is always a good way to understand
I am having some problems with the REPEAT Query in MySQLI asked a similar question not too long ago but it was never answered
Coming from a field of a database I get a result that looks like this