Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 311 and 401] [Versions 39 and 311]

(no description)

File Size: 414 lines (16 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Aggregate:: (7 methods):
  __construct()
  execute()
  getCommandDocument()
  createCommandDocument()
  createCommandOptions()
  createOptions()
  hasWriteStage()


Class: Aggregate  - X-Ref

Operation for the aggregate command.

__construct($databaseName, $collectionName, array $pipeline, array $options = [])   X-Ref
Constructs an aggregate command.

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
circumvent document level validation. This only applies when an $out
or $merge stage is specified.

For servers < 3.2, this option is ignored as document level validation
is not available.

* collation (document): Collation specification.

This is not supported for server versions < 3.4 and will result in an
exception at execution time if used.

* comment (string): An arbitrary string to help trace the operation
through the database profiler, currentOp, and logs.

* explain (boolean): Specifies whether or not to return the information
on the processing of the pipeline.

* hint (string|document): The index to use. Specify either the index
name as a string or the index key pattern as a document. If specified,
then the query system will only consider plans using the hinted index.

* maxTimeMS (integer): The maximum amount of time to allow the query to
run.

* readConcern (MongoDB\Driver\ReadConcern): Read concern.

This is not supported for server versions < 3.2 and will result in an
exception at execution time if used.

* readPreference (MongoDB\Driver\ReadPreference): Read preference.

This option is ignored if an $out or $merge stage is specified.

* session (MongoDB\Driver\Session): Client session.

Sessions are not supported for server versions < 3.6.

* typeMap (array): Type map for BSON deserialization. This will be
applied to the returned Cursor (it is not sent to the server).

* useCursor (boolean): Indicates whether the command will request that
the server provide results using a cursor. The default is true.

This option allows users to turn off cursors if necessary to aid in
mongod/mongos upgrades.

* writeConcern (MongoDB\Driver\WriteConcern): Write concern. This only
applies when an $out or $merge stage is specified.

This is not supported for server versions < 3.4 and will result in an
exception at execution time if used.

Note: Collection-agnostic commands (e.g. $currentOp) may be executed by
specifying null for the collection name.

param: string      $databaseName   Database name
param: string|null $collectionName Collection name
param: array       $pipeline       List of pipeline operations
param: array       $options        Command options

execute(Server $server)   X-Ref
Execute the operation.

param: Server $server
return: Traversable

getCommandDocument(Server $server)   X-Ref
No description

createCommandDocument(Server $server, bool $hasWriteStage)   X-Ref
No description

createCommandOptions()   X-Ref
No description

createOptions($hasWriteStage, $hasExplain)   X-Ref
Create options for executing the command.

param: boolean $hasWriteStage
param: boolean $hasExplain
return: array

hasWriteStage()   X-Ref
No description