title: Aggregate trunc date function?
body: <p>I worked with a bunch of SQL databases before; like Postgres and BigQuery and they have date truncation function (for instance: <a href="https://www.postgresql.org/docs/10/static/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC" rel="nofollow noreferrer"><code>date_trunc</code></a> or <a href="https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#timestamp_trunc" rel="nofollow noreferrer"><code>TIMESTAMP_TRUNC </code></a>).</p>
  <p>I wonder if mongodb has a DATE_TRUNC function?</p>
  <p>I have found the <a href="https://docs.mongodb.com/manual/reference/operator/aggregation/trunc/" rel="nofollow noreferrer"><code>$trunc</code></a> operator but it works for numbers only.</p>
  <p>I want a DATE_TRUNC function to truncate a given Date (the timestamp type in other SQL databases) to a particular boundary, like beginning of year, beginning of month, beginning of hour, may be ok to compose a new Date by getting its year, month, date, hour.</p>
  <p>Does someone have some kinds of workaround? Especially for beginning moment of WEEK, and beginning of ISOWEEK, does anyone have a good workaround?</p>