public function countByGroup($fieldGroup, $match = [], $query = null, $sort = null, $limit = null)
    {
        $group = [
            '_id' => '$'.$fieldGroup,
            'count' => [ '$sum' => 1]
        ];

        return $this->aggregateGroup($group, $match, $query, $sort, $limit);
    }
public function countByGroup($fieldGroup, $match = [], $query = null, $sort = null, $limit = null)
    {
        $group = [
            '_id' => '$'.$fieldGroup,
            'count' => [ '$sum' => 1]
        ];

        return $this->aggregateGroup($group, $match, $query, $sort, $limit);
    }
public function countByGroup ( $ fieldGroup , $ match = [ ] , $ query = null , $ sort = null , $ limit = null ) { $ group = [ '_id' => '$' . $ fieldGroup , 'count' => [ '$sum' => 1 ] ] ; return $ this -> aggregateGroup ( $ group , $ match , $ query , $ sort , $ limit ) ; }
Count items by group

@param mixed $collection
@param mixed $fieldGroup
@param mixed $match

@return array Multidimensional array with key => count per group
Count items by group