PHP Class Sokil\Mongo\Pipeline

Inheritance: implements Sokil\Mongo\ArrayableInterface, implements JsonSerializable
显示文件 Open project: sokil/php-mongo Class Usage Examples

Public Methods

Method Description
__construct ( Collection $collection )
__toString ( )
aggregate ( array $options = [] )
aggregateCursor ( array $options = [] )
allowDiskUse ( $allow = true )
explain ( $allow = true )
getOptions ( )
group ( array | callable $stage ) : Pipeline Groups documents by some specified expression and outputs to the next stage a document for each distinct grouping. The output documents contain an _id field which contains the distinct group by key. The output documents can also contain computed fields that hold the values of some accumulator expression grouped by the $group‘s _id field. $group does not order its output documents.
jsonSerialize ( )
limit ( $limit )
match ( array | Expression $expression ) : Pipeline Filter documents by expression
project ( array $pipeline ) : Pipeline Passes along the documents with only the specified fields to the next stage in the pipeline. The specified fields can be existing fields from the input documents or newly computed fields.
setBatchSize ( $batchSize )
skip ( $skip )
sort ( array $sortFields )
toArray ( )
unwind ( string $path ) : Pipeline Deconstructs an array field from the input documents to output a document for each element.

Private Methods

Method Description
addStage ( string $operator, mixed $stage )

Method Details

__construct() public method

public __construct ( Collection $collection )
$collection Collection

__toString() public method

public __toString ( )

aggregate() public method

public aggregate ( array $options = [] )
$options array

aggregateCursor() public method

public aggregateCursor ( array $options = [] )
$options array

allowDiskUse() public method

public allowDiskUse ( $allow = true )

explain() public method

public explain ( $allow = true )

getOptions() public method

public getOptions ( )

group() public method

Groups documents by some specified expression and outputs to the next stage a document for each distinct grouping. The output documents contain an _id field which contains the distinct group by key. The output documents can also contain computed fields that hold the values of some accumulator expression grouped by the $group‘s _id field. $group does not order its output documents.
public group ( array | callable $stage ) : Pipeline
$stage array | callable
return Pipeline

jsonSerialize() public method

public jsonSerialize ( )

limit() public method

public limit ( $limit )

match() public method

Filter documents by expression
public match ( array | Expression $expression ) : Pipeline
$expression array | Expression
return Pipeline

project() public method

Passes along the documents with only the specified fields to the next stage in the pipeline. The specified fields can be existing fields from the input documents or newly computed fields.
public project ( array $pipeline ) : Pipeline
$pipeline array
return Pipeline

setBatchSize() public method

public setBatchSize ( $batchSize )

skip() public method

public skip ( $skip )

sort() public method

public sort ( array $sortFields )
$sortFields array

toArray() public method

public toArray ( )

unwind() public method

Each output document is the input document with the value of the array field replaced by the element.
public unwind ( string $path ) : Pipeline
$path string path to field
return Pipeline