Hi.
I’m developing some software using mongodb and I happened to need a way for aggregate the data by week.
But I don’t know how to do it when the week is crossing year.
I’m now doing it by using
$dateToString{
format : "_%Y_ _ _ _ _ _%U_",
date : $foundTime
}
and then group by this string.
when the weeks are inside of one year, everything goes fine.
but when things go to the week accrossing two years, it will be seperate into two segments,
one be “2020 _ _ _ _ 52”, another be “2021 _ _ _ _ 00”