src/Webiny/AnalyticsDb/Query/Dimensions.php
public function sortByDimensionName($direction)
    {
        if ($this->id != '$name' && $this->id != '$value') {
            throw new AnalyticsDbException('In order to sort by dimension name, you need to first group by dimension name or dimension value.');
        }

        $direction = (int)$direction;

        if ($this->id == '$name') {
            $this->pipeline['$sort'] = ['_id' => $direction];
        } else {
            $this->pipeline['$sort'] = ['_id.name' => $direction];
        }


        return $this;
    }
public function sortByDimensionName($direction)
    {
        if ($this->id != '$name' && $this->id != '$value') {
            throw new AnalyticsDbException('In order to sort by dimension name, you need to first group by dimension name or dimension value.');
        }

        $direction = (int)$direction;

        if ($this->id == '$name') {
            $this->pipeline['$sort'] = ['_id' => $direction];
        } else {
            $this->pipeline['$sort'] = ['_id.name' => $direction];
        }


        return $this;
    }
public function sortByDimensionName ( $ direction ) { if ( $ this -> id != '$name' && $ this -> id != '$value' ) { throw new AnalyticsDbException ( 'In order to sort by dimension name, you need to first group by dimension name or dimension value.' ) ; } $ direction = ( int ) $ direction ; if ( $ this -> id == '$name' ) { $ this -> pipeline [ '$sort' ] = [ '_id' => $ direction ] ; } else { $ this -> pipeline [ '$sort' ] = [ '_id.name' => $ direction ] ; } return $ this ; }
Sort records by dimension name.

@param string $direction Mongo sort direction: 1 => ascending; -1 => descending

@return $this
@throws AnalyticsDbException
Sort records by dimension name .