I am trying to find x objects by date, (the receipt of a form, I know it arrives in UTC format before the real one), I do the following.
First I create the object
console.log(datos) // Contiene los datos correctos , fecha ,datos ,etc
Evento.create(datos,(err,evento)=>{
if(err)console.log("Error");
else{
console.log("Eventro creado",evento);
Task.create({
fecha:datos.fecha,
cron: {
enabled: true,
startAt: datos.fecha,
interval: '40 * * * * *'
}
});
User.update({_id:datos.creador},{$push:{eventos:evento._id}},{},(err,user)=>{
if(err)console.log(err);
else{
console.log("Usuario actualizado");
console.log(user);
}
});
}
});
I check in the bd, and in fact, I believe that event with the corresponding date, but then there below I try to search for
console.log("Buscaremos el evento x por fecha");
Evento.find({fecha:datos.fecha},(err,ev)=>{
console.log("Estos son los eventos encontrados",ev);
})
and I get ev = [], having an event that matches the given date, and review and the dates are the same, what could be happening?