I have the following $project code:
current_day: {$isoDayOfWeek: “$time_stamp_sign_on_ISODate”}
{$project: {current_day: 1, total_work_time_hours_base10_rounded: 1, total_worktime_seconds: 1, weekday: { $or: [ { $gte: [ “$current_day”, 1 ] },
{ $lte: [ “$current_day”, 5 ] } ] }, weekend_day: { $or: [ { $eq: [ “$current_day”, 6 ] },
{ $eq: [ “$current_day”, 7 ] } ] }}
}
The code should classify current_day as a weekend_day when the $isoDayOfWeek value is either 6 or 7. The current_day should be classified as a weekday if the $isoDayOfWeek value is between 1 and 5.
The query is able to print the correct $isoDayOfWeek value, but the logic implemented with - $gte, $lte, $or - fails.
Do you have any ideas about what could be wrong?
Cheers,
Daniel