@@ 546-562 (lines=17) @@ | ||
543 | * @return $this |
|
544 | * @throws \BadMethodCallException if the query is not a mapReduce or group command |
|
545 | */ |
|
546 | public function finalize($finalize) |
|
547 | { |
|
548 | switch ($this->query['type']) { |
|
549 | case Query::TYPE_MAP_REDUCE: |
|
550 | $this->query['mapReduce']['options']['finalize'] = $finalize; |
|
551 | break; |
|
552 | ||
553 | case Query::TYPE_GROUP: |
|
554 | $this->query['group']['options']['finalize'] = $finalize; |
|
555 | break; |
|
556 | ||
557 | default: |
|
558 | throw new \BadMethodCallException('mapReduce(), map() or group() must be called before finalize()'); |
|
559 | } |
|
560 | ||
561 | return $this; |
|
562 | } |
|
563 | ||
564 | /** |
|
565 | * Change the query type to find and optionally set and change the class being queried. |
|
@@ 1409-1425 (lines=17) @@ | ||
1406 | * @return $this |
|
1407 | * @throws \BadMethodCallException if the query is not a mapReduce or group command |
|
1408 | */ |
|
1409 | public function reduce($reduce) |
|
1410 | { |
|
1411 | switch ($this->query['type']) { |
|
1412 | case Query::TYPE_MAP_REDUCE: |
|
1413 | $this->query['mapReduce']['reduce'] = $reduce; |
|
1414 | break; |
|
1415 | ||
1416 | case Query::TYPE_GROUP: |
|
1417 | $this->query['group']['reduce'] = $reduce; |
|
1418 | break; |
|
1419 | ||
1420 | default: |
|
1421 | throw new \BadMethodCallException('mapReduce(), map() or group() must be called before reduce()'); |
|
1422 | } |
|
1423 | ||
1424 | return $this; |
|
1425 | } |
|
1426 | ||
1427 | /** |
|
1428 | * @param object $document |