1
This id_message I send by parameter by my request, a console.log in this returns me the value of the image.
const id_mensagem = [...new Set(response.data.map(mensagens => mensagens.id_mensagem))]
in my back I get this info this way:
const {id_mensagem} = req.params
a console.log returns me 423,421,422
.
However I need to pass this value between brackets for a query in the database, query code:
const mensagens = await Mensagens.findAll({
where:{
id_mensagem:{
[Op.in]:[id_mensagem]
}
},
order: [['created_at','DESC']],
})
and here comes the problem, I’m using sequelize in this case and when he query and he searches only the first numbers before the comma, a console.log([id_message]) returns me this way: I understand that being wrapped in quotes the code is ignoring what comes after the first comma, finally how to turn this ['423,421,422'] into separate numbers for consultation! ex: [423,421,422].
show... went well!
– Diego Schinemann