src/Webiny/AnalyticsDb/Query/AbstractQuery.php
public function sortByTimestamp($direction)
    {
        if ($this->id != '$ts') {
            throw new AnalyticsDbException('In order to sort by timestamp, you need to first group by timestamp.');
        }

        $direction = (int)$direction;
        $this->pipeline['$sort'] = ['_id' => $direction];

        return $this;
    }
public function sortByTimestamp($direction)
    {
        if ($this->id != '$ts') {
            throw new AnalyticsDbException('In order to sort by timestamp, you need to first group by timestamp.');
        }

        $direction = (int)$direction;
        $this->pipeline['$sort'] = ['_id' => $direction];

        return $this;
    }
public function sortByTimestamp ( $ direction ) { if ( $ this -> id != '$ts' ) { throw new AnalyticsDbException ( 'In order to sort by timestamp, you need to first group by timestamp.' ) ; } $ direction = ( int ) $ direction ; $ this -> pipeline [ '$sort' ] = [ '_id' => $ direction ] ; return $ this ; }
Sorts the result by timestamp.

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

@return $this
@throws AnalyticsDbException
Sorts the result by timestamp .