PHP Class Sokil\Mongo\Pipeline\GroupStage

Inheritance: implements Sokil\Mongo\ArrayableInterface
Show file Open project: sokil/php-mongo

Public Methods

Method Description
addToSet ( string $field, literal | callable | Sokil\Mongo\Pipeline\Expression $expression ) : GroupStage Add to set accumulator
avg ( string $field, literal | callable | Sokil\Mongo\Pipeline\Expression $expression ) : GroupStage Average accumulator
first ( string $field, literal | callable | Sokil\Mongo\Pipeline\Expression $expression ) : GroupStage Returns the value that results from applying an expression to the first document in a group of documents that share the same group by key. Only meaningful when documents are in a defined order.
last ( string $field, literal | callable | Sokil\Mongo\Pipeline\Expression $expression ) : GroupStage Returns the value that results from applying an expression to the last document in a group of documents that share the same group by a field.
max ( string $field, literal | callable | Sokil\Mongo\Pipeline\Expression $expression ) : GroupStage Returns the highest value that results from applying an expression to each document in a group of documents that share the same group by key.
min ( string $field, literal | callable | Sokil\Mongo\Pipeline\Expression $expression ) : GroupStage Returns the lowest value that results from applying an expression to each document in a group of documents that share the same group by key.
push ( string $field, literal | callable | Sokil\Mongo\Pipeline\Expression $expression ) : GroupStage Returns an array of all values that result from applying an expression to each document in a group of documents that share the same group by key.
setId ( $id )
sum ( string $field, literal | callable | Sokil\Mongo\Pipeline\Expression $expression ) : GroupStage Sum accumulator
toArray ( )

Method Details

addToSet() public method

Returns an array of all unique values that results from applying an expression to each document in a group of documents that share the same group by key. Order of the elements in the output array is unspecified.
public addToSet ( string $field, literal | callable | Sokil\Mongo\Pipeline\Expression $expression ) : GroupStage
$field string
$expression literal | callable | Sokil\Mongo\Pipeline\Expression Expression
return GroupStage

avg() public method

Returns the average value of the numeric values that result from applying a specified expression to each document in a group of documents that share the same group by key. $avg ignores non-numeric values.
public avg ( string $field, literal | callable | Sokil\Mongo\Pipeline\Expression $expression ) : GroupStage
$field string
$expression literal | callable | Sokil\Mongo\Pipeline\Expression Expression
return GroupStage

first() public method

Returns the value that results from applying an expression to the first document in a group of documents that share the same group by key. Only meaningful when documents are in a defined order.
public first ( string $field, literal | callable | Sokil\Mongo\Pipeline\Expression $expression ) : GroupStage
$field string
$expression literal | callable | Sokil\Mongo\Pipeline\Expression Expression
return GroupStage

last() public method

Only meaningful when documents are in a defined order.
public last ( string $field, literal | callable | Sokil\Mongo\Pipeline\Expression $expression ) : GroupStage
$field string
$expression literal | callable | Sokil\Mongo\Pipeline\Expression Expression
return GroupStage

max() public method

Returns the highest value that results from applying an expression to each document in a group of documents that share the same group by key.
public max ( string $field, literal | callable | Sokil\Mongo\Pipeline\Expression $expression ) : GroupStage
$field string
$expression literal | callable | Sokil\Mongo\Pipeline\Expression Expression
return GroupStage

min() public method

Returns the lowest value that results from applying an expression to each document in a group of documents that share the same group by key.
public min ( string $field, literal | callable | Sokil\Mongo\Pipeline\Expression $expression ) : GroupStage
$field string
$expression literal | callable | Sokil\Mongo\Pipeline\Expression Expression
return GroupStage

push() public method

Returns an array of all values that result from applying an expression to each document in a group of documents that share the same group by key.
public push ( string $field, literal | callable | Sokil\Mongo\Pipeline\Expression $expression ) : GroupStage
$field string
$expression literal | callable | Sokil\Mongo\Pipeline\Expression Expression
return GroupStage

setId() public method

public setId ( $id )

sum() public method

Calculates and returns the sum of all the numeric values that result from applying a specified expression to each document in a group of documents that share the same group by key. $sum ignores non-numeric values.
public sum ( string $field, literal | callable | Sokil\Mongo\Pipeline\Expression $expression ) : GroupStage
$field string
$expression literal | callable | Sokil\Mongo\Pipeline\Expression Expression
return GroupStage

toArray() public method

public toArray ( )