I am creating a restFull api with nodejs and mongodb. I'm trying to do a query on mongodb and nodejs, but I do not get the form. I have the problem in looking over the array that arrives by parameter, I try to make the $ in on the array and it gets stuck.
exports.getAlertasDistritoCategoria = (distrito, categorias) =>
new Promise((resolve, reject) => {
alerta.find({distrito: distrito, categoria:{$in:categorias}}).sort({fecha:-1})
.then(alertas => categorias)
.catch(err => reject({status: 500, message: 'Internal Server Error! verAlertasDistritoCategoria.js'}))
});