|
@@ 563-579 (lines=17) @@
|
| 560 |
|
* @return $this |
| 561 |
|
* @throws \BadMethodCallException if the query is not a mapReduce or group command |
| 562 |
|
*/ |
| 563 |
|
public function finalize($finalize) |
| 564 |
|
{ |
| 565 |
|
switch ($this->query['type']) { |
| 566 |
|
case Query::TYPE_MAP_REDUCE: |
| 567 |
|
$this->query['mapReduce']['options']['finalize'] = $finalize; |
| 568 |
|
break; |
| 569 |
|
|
| 570 |
|
case Query::TYPE_GROUP: |
| 571 |
|
$this->query['group']['options']['finalize'] = $finalize; |
| 572 |
|
break; |
| 573 |
|
|
| 574 |
|
default: |
| 575 |
|
throw new \BadMethodCallException('mapReduce(), map() or group() must be called before finalize()'); |
| 576 |
|
} |
| 577 |
|
|
| 578 |
|
return $this; |
| 579 |
|
} |
| 580 |
|
|
| 581 |
|
/** |
| 582 |
|
* Change the query type to find and optionally set and change the class being queried. |
|
@@ 1430-1446 (lines=17) @@
|
| 1427 |
|
* @return $this |
| 1428 |
|
* @throws \BadMethodCallException if the query is not a mapReduce or group command |
| 1429 |
|
*/ |
| 1430 |
|
public function reduce($reduce) |
| 1431 |
|
{ |
| 1432 |
|
switch ($this->query['type']) { |
| 1433 |
|
case Query::TYPE_MAP_REDUCE: |
| 1434 |
|
$this->query['mapReduce']['reduce'] = $reduce; |
| 1435 |
|
break; |
| 1436 |
|
|
| 1437 |
|
case Query::TYPE_GROUP: |
| 1438 |
|
$this->query['group']['reduce'] = $reduce; |
| 1439 |
|
break; |
| 1440 |
|
|
| 1441 |
|
default: |
| 1442 |
|
throw new \BadMethodCallException('mapReduce(), map() or group() must be called before reduce()'); |
| 1443 |
|
} |
| 1444 |
|
|
| 1445 |
|
return $this; |
| 1446 |
|
} |
| 1447 |
|
|
| 1448 |
|
/** |
| 1449 |
|
* @param object $document |