@@ 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. |
|
@@ 1413-1429 (lines=17) @@ | ||
1410 | * @return $this |
|
1411 | * @throws \BadMethodCallException if the query is not a mapReduce or group command |
|
1412 | */ |
|
1413 | public function reduce($reduce) |
|
1414 | { |
|
1415 | switch ($this->query['type']) { |
|
1416 | case Query::TYPE_MAP_REDUCE: |
|
1417 | $this->query['mapReduce']['reduce'] = $reduce; |
|
1418 | break; |
|
1419 | ||
1420 | case Query::TYPE_GROUP: |
|
1421 | $this->query['group']['reduce'] = $reduce; |
|
1422 | break; |
|
1423 | ||
1424 | default: |
|
1425 | throw new \BadMethodCallException('mapReduce(), map() or group() must be called before reduce()'); |
|
1426 | } |
|
1427 | ||
1428 | return $this; |
|
1429 | } |
|
1430 | ||
1431 | /** |
|
1432 | * @param object $document |