I want to make a compound query in mongodb, which must add 1 for each true that it detects, but it is not working correctly, since it counts both the true and the false.
{
_id: "resumen",
summary: { $sum:
{ $cond: [ asistencia: false, 1, 0 ] }
}
}
Example of my data:
{
_id: ObjectId(5fb8722ec775d2f89c47b00d),
id_asesor: ObjectId(5fb72a4245494b99847d63c2),
nombre_evento:" Reunión"persona:"Joaquin Vazquez Muños",
inicio: 2020-11-20T06:00:00.000+00:00,
fin_ev: 2020-11-20T07:00:00.000+00:00,
duracion: 60,
asistencia: false <- this is the data to validate
}