PHP Class Phalcon\Db\Adapter\MongoDB\Operation\Aggregate

See also: MongoDB\Collection::aggregate()
See also: http://docs.mongodb.org/manual/reference/command/aggregate/
Inheritance: implements Phalcon\Db\Adapter\MongoDB\Operation\Executable
Show file Open project: phalcon/incubator Class Usage Examples

Public Methods

Method Description
__construct ( string $databaseName, string $collectionName, array $pipeline, array $options = [] ) Constructs an aggregate command.
execute ( MongoDB\Driver\Server $server ) : Traversable Execute the operation.

Private Methods

Method Description
createCommand ( MongoDB\Driver\Server $server, boolean $isCursorSupported ) : MongoDB\Driver\Command Create the aggregate command.

Method Details

__construct() public method

Supported options: * allowDiskUse (boolean): Enables writing to temporary files. When set to true, aggregation stages can write data to the _tmp sub-directory in the dbPath directory. The default is false. * batchSize (integer): The number of documents to return per batch. * bypassDocumentValidation (boolean): If true, allows the write to opt out of document level validation. This only applies when the $out stage is specified. For servers < 3.2, this option is ignored as document level validation is not available. * maxTimeMS (integer): The maximum amount of time to allow the query to run. * readConcern (MongoDB\Driver\ReadConcern): Read concern. Note that a "majority" read concern is not compatible with the $out stage. For servers < 3.2, this option is ignored as read concern is not available. * readPreference (MongoDB\Driver\ReadPreference): Read preference. * typeMap (array): Type map for BSON deserialization. This will be applied to the returned Cursor (it is not sent to the server). This is not supported for inline aggregation results (i.e. useCursor option is false or the server versions < 2.6). * useCursor (boolean): Indicates whether the command will request that the server provide results using a cursor. The default is true. For servers < 2.6, this option is ignored as aggregation cursors are not available. For servers >= 2.6, this option allows users to turn off cursors if necessary to aid in mongod/mongos upgrades.
public __construct ( string $databaseName, string $collectionName, array $pipeline, array $options = [] )
$databaseName string Database name
$collectionName string Collection name
$pipeline array List of pipeline operations
$options array Command options

execute() public method

Execute the operation.
See also: Executable::execute()
public execute ( MongoDB\Driver\Server $server ) : Traversable
$server MongoDB\Driver\Server
return Traversable