title: Group in aggregation including the null values in mongodb
body: <p>I am trying to group by month and year in an aggregation and return the months that have no data too.<br></p>
  
  <p><strong>Example</strong>:<br>
  if the period is 01/01/2018 to 01/03/2018 and we search for a rating and rating exists only in February I still want to get January and March with no rating.<br></p>
  
  <pre><code>$pipeline = [
        ['$match'=&gt;[
              'rating'     =&gt; ['$exists' =&gt; true],
              'date' =&gt; [
                                '$gte' =&gt; $da-&gt;getStart(true),
                                '$lte' =&gt; $da-&gt;getEnd(true)
                              ],
                    ]
        ],
        ['$project' =&gt; [
                'year'  =&gt; [
                  '$cond' =&gt;  [
                      ['$ifNull' =&gt; [$date-&gt;appendDollarSing(), 0]],
                      ['$year' =&gt;  $date-&gt;appendDollarSing()],
                      -1
                  ],
                'month' =&gt; [
                  '$cond' =&gt; [
                      ['$ifNull' =&gt; [$date-&gt;appendDollarSing(), 0]],
                      ['$month' =&gt;  $date-&gt;appendDollarSing()],
                      -1
                  ],
                'rating'  =&gt; ['$sum'  =&gt; '$rating'],
            ]
        ],
        ['$group' =&gt; [
                    '_id' =&gt; ['year' =&gt; '$year', 'month' =&gt;'$month'],
                    'rating'  =&gt; ['$sum'  =&gt; '$rating'],
                    'count'   =&gt; ['$sum'  =&gt; 1],
                    ]
              ],
      ];
  </code></pre>
  
  <p>The above query returns the months with rating as I used exists true for the rating. However even if I remove the exists true it does not fetches the months with no rating</p>