In postgres we use the below code when we need a time series data for a line chart
SELECT date_trunc('day', dd)::date
FROM generate_series
( '2004-04-01'::timestamp
, '2005-04-01'::timestamp
, '1 day'::interval) dd
LEFT JOIN school_attendence on dd = school_attendence.attendence_date
Is there a similar function in mongodb or mongoose library that will do the job for me?