Moodle PHP Documentation 4.1
Moodle 4.1.11 (Build: 20240610) (c8c84b4af18)
|
Public Member Functions | |
__construct (string $databaseName, string $collectionName, JavascriptInterface $map, JavascriptInterface $reduce, $out, array $options=[]) | |
Constructs a mapReduce command. | |
execute (Server $server) | |
Execute the operation. | |
MongoDB\Operation\MapReduce::__construct | ( | string | $databaseName, |
string | $collectionName, | ||
JavascriptInterface | $map, | ||
JavascriptInterface | $reduce, | ||
$out, | |||
array | $options = [] ) |
Constructs a mapReduce command.
Required arguments:
map (MongoDB\BSON\Javascript): A JavaScript function that associates or "maps" a value with a key and emits the key and value pair.
Passing a Javascript instance with a scope is deprecated. Put all scope variables in the "scope" option of the MapReduce operation.
reduce (MongoDB\BSON\Javascript): A JavaScript function that "reduces" to a single object all the values associated with a particular key.
Passing a Javascript instance with a scope is deprecated. Put all scope variables in the "scope" option of the MapReduce operation.
Supported options:
comment (mixed): BSON value to attach as a comment to this command.
This is not supported for servers versions < 4.4.
finalize (MongoDB\BSON\JavascriptInterface): Follows the reduce method and modifies the output.
Passing a Javascript instance with a scope is deprecated. Put all scope variables in the "scope" option of the MapReduce operation.
readPreference (MongoDB\Driver\ReadPreference): Read preference.
This option is ignored if results are output to a collection.
string | $databaseName | Database name |
string | $collectionName | Collection name |
JavascriptInterface | $map | Map function |
JavascriptInterface | $reduce | Reduce function |
string | array | object | $out | Output specification |
array | $options | Command options |
InvalidArgumentException | for parameter/option parsing errors |
MongoDB\Operation\MapReduce::execute | ( | Server | $server | ) |
Execute the operation.
MapReduceResult |
UnexpectedValueException | if the command response was malformed |
UnsupportedException | if read concern or write concern is used and unsupported |
DriverRuntimeException | for other driver errors (e.g. connection errors) |
Implements MongoDB\Operation\Executable.