In cases like this where you’re getting an error from a .aggregate() call, the first thing to do while troubleshooting it to format your query so you can easily see how the brackets line up. Your query lines up as follows:
Notice that there is an extra closing brace in your $project so a lot of the files for projection have been moved outside that stage. This has also thrown everything else off.
Using variables for stages help in finding errors, it is adaptation of Divide And Conquer. For example:
mongosh> match_stage = {$match:{Diadelasemana:{$in:[1,7]},$and:[{Diadelasemana:6},{Hora:{$gte:16}}],$and:[{Diadelasemana:2},{Hora:{$lt:8}}]}}
/* produce the output */
{$match:{Diadelasemana:{$in:[1,7]},$and:[{Diadelasemana:2},{Hora:{$lt:8}}]}}
Because with JSON you cannot have an object with duplicate key. Well, you can but you only get the last occurrence. Anyway in this case the logic is wrong since you cannot have
both Diadelasemana:2 and Diadelasemana:6 both true.
I deleted my post because it was not correct. Not the part about you being smarter than me (I do feel this is correct and I’ve learned a lot from you over the years here), but the part about my having the brackets incorrect.