title: mongoose aggregate return an object with count if no documents found
body: <p>I have a query which works in a way that it search for bookings between two dates</p>
  <pre><code>const bookings = await Bookings.aggregate([
        {
          $match: {
            store: {
              $in: storeIds,
            },
            bookingDate: {
              $gte: new Date(&quot;2022-09-04&quot;),
              $lte: new Date(&quot;2022-09-10&quot;),
            },
          },
        },
        {
          $group: {
            _id: &quot;$bookingDate&quot;,
            count: {
              $sum: 1,
            },
          },
        },
        { $sort: { _id: 1 } },
      ]);
  </code></pre>
  <p>Result:</p>
  <pre><code>[
          {
              &quot;_id&quot;: &quot;2022-09-04T00:00:00.000Z&quot;,
              &quot;count&quot;: 1
          },
          {
              &quot;_id&quot;: &quot;2022-09-06T00:00:00.000Z&quot;,
              &quot;count&quot;: 1
          },
          {
              &quot;_id&quot;: &quot;2022-09-07T00:00:00.000Z&quot;,
              &quot;count&quot;: 1
          },
          {
              &quot;_id&quot;: &quot;2022-09-08T00:00:00.000Z&quot;,
              &quot;count&quot;: 3
          },
          {
              &quot;_id&quot;: &quot;2022-09-09T00:00:00.000Z&quot;,
              &quot;count&quot;: 3
          },
          {
              &quot;_id&quot;: &quot;2022-09-10T00:00:00.000Z&quot;,
              &quot;count&quot;: 2
          }
      ]
  </code></pre>
  <p>But, there's a date 5 that doesn't contain any booking, what I want is if any date has no bookings and the object will generate containing a date as _id and a count of 0. Any solution for this?
  So, my expected output is down below, Array[1] contains 2022-09-05 with count 0. Although I tried various methods to do so. But I got no success yet.. Please help me out</p>
  <p>Expected output:</p>
  <pre><code>[
          {
              &quot;_id&quot;: &quot;2022-09-04T00:00:00.000Z&quot;,
              &quot;count&quot;: 1
          },
          {
              &quot;_id&quot;: &quot;2022-09-05T00:00:00.000Z&quot;,
              &quot;count&quot;: 0
          },
          {
              &quot;_id&quot;: &quot;2022-09-06T00:00:00.000Z&quot;,
              &quot;count&quot;: 1
          },
          {
              &quot;_id&quot;: &quot;2022-09-07T00:00:00.000Z&quot;,
              &quot;count&quot;: 1
          },
          {
              &quot;_id&quot;: &quot;2022-09-08T00:00:00.000Z&quot;,
              &quot;count&quot;: 3
          },
          {
              &quot;_id&quot;: &quot;2022-09-09T00:00:00.000Z&quot;,
              &quot;count&quot;: 3
          },
          {
              &quot;_id&quot;: &quot;2022-09-10T00:00:00.000Z&quot;,
              &quot;count&quot;: 2
          }
      ]
  </code></pre>