As the title says
consider dummy data like this (some users in my mongoose database)
[{ name : "ahmed" , registeredIn : 1590739626724 },
{ name : "ahmed" , registeredIn : 1590739626724 }
{ name : "ahmed" , registeredIn : 1590739626724 }
{ name : "ahmed" , registeredIn : 1590739626724 }
{ name : "ahmed" , registeredIn : 1590739626724 }]
in my admin panel , I'd like to return a chart which display number of registered users per each month
just need numbers , 2 in May , 3 in June and so on..
what's the quickest solutions ?
the only solution in my mind now is a bit bad
to fetch each month separately
fetch users between timestamp X & Y
fetch users between timestamp X & Y
fetch users between timestamp X & Y
fetch users between timestamp X & Y
what if I want to fetch about 20 months , will I call the MongoDB 20 times ?
is there any more better solution ?