title: Aggregate total and distinct count
body: <p>I have a document to stored products, one receipt can have many products inside. </p>
  
  <pre><code>{"_id" : "59871e65fffe165420e0b324"
  "receiptid" : "4BA/ZFY7AQ4HvfjUMTRTLg=="
  "area_type" : 1
  "report_type" : 3
  "id_station" : 2317
  "date" : "2017-08-05 00:00:00.000"
  "time" : "1501979220"
  "amount" : 10113958
  "item" : 32
  },
  {"_id" : "59871e65fffe165420e0b324"
  "receiptid" : "4BA/ZFY7AQ4HvfjUMTRTLg=="
  "area_type" : 1
  "report_type" : 3
  "id_station" : 2317
  "date" : "2017-08-05 00:00:00.000"
  "time" : "1501979320"
  "amount" : 4000000
  "item" : 12
  }
  </code></pre>
  
  <p>I want to count total amount and total receipt in one query:</p>
  
  <pre><code>$store = array(2317);
  $cursor = $collection-&gt;aggregate([
      ['$match' =&gt; [ 'id_station' =&gt; ['$in' =&gt; $store ], 'date' =&gt; ['$gte'=&gt; new MongoDB\BSON\UTCDateTime(strtotime("2017-08-01")*1000), '$lte'=&gt; new MongoDB\BSON\UTCDateTime(strtotime("2017-08-01")*1000)]  ] ],              
  
      ['$group' =&gt; ['_id' =&gt; ["id_station" =&gt; '$id_station'], 
                   "amountclient"=&gt; ['$sum' =&gt; '$amount']
                  ]
      ],
      ['$group' =&gt; ['_id' =&gt; ["id_station" =&gt; '$id_station', "receiptid" =&gt; '$receiptid'], 
                   "receipt"=&gt; ['$sum' =&gt; 1]
                  ]
      ]
  ]);
  </code></pre>
  
  <p>But the query doesn't show anything, how can I correct it?<br>
  I want the result:
  {"store" => xxxx, "amount" => xxxx, "number of receipt" => xxx}</p>