mapReduce() public method
Generates 'map-reduce' command.
| public array mapReduce ( $collectionName, $map, $reduce, $out, $condition = [], $options = [] ) | ||
|---|---|---|
| $collectionName | string |
Collection name. |
| $map | \MongoDB\BSON\Javascript|string |
Function, which emits map data from collection. Argument will be automatically cast to \MongoDB\BSON\Javascript. |
| $reduce | \MongoDB\BSON\Javascript|string |
Function that takes two arguments (the map key and the map values) and does the aggregation. Argument will be automatically cast to \MongoDB\BSON\Javascript. |
| $out | string|array |
Output collection name. It could be a string for simple output ('outputCollection'), or an array for parametrized output (['merge' => 'outputCollection']). You can pass ['inline' => true] to fetch the result at once without temporary collection usage. |
| $condition | array |
Filter condition for including a document in the aggregation. |
| $options | array |
Additional optional parameters to the mapReduce command. Valid options include:
|
| return | array |
Command document. |
Please login to continue.