public function average($q, $db = null)
    {
        if (!empty($this->emulateExecution)) {
            return 0;
        }
        return $this->aggregate($q, 'avg', $db);
    }
public function average($q, $db = null)
    {
        if (!empty($this->emulateExecution)) {
            return 0;
        }
        return $this->aggregate($q, 'avg', $db);
    }
public function average ( $ q , $ db = null ) { if ( ! empty ( $ this -> emulateExecution ) ) { return 0 ; } return $ this -> aggregate ( $ q , 'avg' , $ db ) ; }
Returns the average of the specified column values.
@param string $q the column name.
Make sure you properly quote column names in the expression.
@param Connection $db the Mongo connection used to execute the query.
If this parameter is not given, the `mongodb` application component will be used.
@return int the average of the specified column values.
Returns the average of the specified column values .