@@ 525-541 (lines=17) @@ | ||
522 | * @return $this |
|
523 | * @throws \BadMethodCallException if the query is not a mapReduce or group command |
|
524 | */ |
|
525 | public function finalize($finalize) |
|
526 | { |
|
527 | switch ($this->query['type']) { |
|
528 | case Query::TYPE_MAP_REDUCE: |
|
529 | $this->query['mapReduce']['options']['finalize'] = $finalize; |
|
530 | break; |
|
531 | ||
532 | case Query::TYPE_GROUP: |
|
533 | $this->query['group']['options']['finalize'] = $finalize; |
|
534 | break; |
|
535 | ||
536 | default: |
|
537 | throw new \BadMethodCallException('mapReduce(), map() or group() must be called before finalize()'); |
|
538 | } |
|
539 | ||
540 | return $this; |
|
541 | } |
|
542 | ||
543 | /** |
|
544 | * Change the query type to find and optionally set and change the class being queried. |
|
@@ 1353-1369 (lines=17) @@ | ||
1350 | * @return $this |
|
1351 | * @throws \BadMethodCallException if the query is not a mapReduce or group command |
|
1352 | */ |
|
1353 | public function reduce($reduce) |
|
1354 | { |
|
1355 | switch ($this->query['type']) { |
|
1356 | case Query::TYPE_MAP_REDUCE: |
|
1357 | $this->query['mapReduce']['reduce'] = $reduce; |
|
1358 | break; |
|
1359 | ||
1360 | case Query::TYPE_GROUP: |
|
1361 | $this->query['group']['reduce'] = $reduce; |
|
1362 | break; |
|
1363 | ||
1364 | default: |
|
1365 | throw new \BadMethodCallException('mapReduce(), map() or group() must be called before reduce()'); |
|
1366 | } |
|
1367 | ||
1368 | return $this; |
|
1369 | } |
|
1370 | ||
1371 | /** |
|
1372 | * @param object $document |