src/League/Monga/Query/Computer.php
public function sum($result, $field = 1)
    {
        $field = $this->prepareField($field);

        $this->fields[$result] = ['$sum' => $field];

        return $this;
    }
public function sum($result, $field = 1)
    {
        $field = $this->prepareField($field);

        $this->fields[$result] = ['$sum' => $field];

        return $this;
    }
public function sum ( $ result , $ field = 1 ) { $ field = $ this -> prepareField ( $ field ) ; $ this -> fields [ $ result ] = [ '$sum' => $ field ] ; return $ this ; }
Aggregate a sum from a field.

@param string $result result key
@param mixed  $field  field to take the sum from, 1 for totals

@return object $this
Aggregate a sum from a field .