| @@ 500-513 (lines=14) @@ | ||
| 497 | * @param array|string $fieldName,... |
|
| 498 | * @return $this |
|
| 499 | */ |
|
| 500 | public function exclude($fieldName = null) |
|
| 501 | { |
|
| 502 | if ( ! isset($this->query['select'])) { |
|
| 503 | $this->query['select'] = []; |
|
| 504 | } |
|
| 505 | ||
| 506 | $fieldNames = is_array($fieldName) ? $fieldName : func_get_args(); |
|
| 507 | ||
| 508 | foreach ($fieldNames as $fieldName) { |
|
| 509 | $this->query['select'][$fieldName] = 0; |
|
| 510 | } |
|
| 511 | ||
| 512 | return $this; |
|
| 513 | } |
|
| 514 | ||
| 515 | /** |
|
| 516 | * Specify $exists criteria for the current field. |
|
| @@ 1512-1525 (lines=14) @@ | ||
| 1509 | * @param array|string $fieldName,... |
|
| 1510 | * @return $this |
|
| 1511 | */ |
|
| 1512 | public function select($fieldName = null) |
|
| 1513 | { |
|
| 1514 | if ( ! isset($this->query['select'])) { |
|
| 1515 | $this->query['select'] = []; |
|
| 1516 | } |
|
| 1517 | ||
| 1518 | $fieldNames = is_array($fieldName) ? $fieldName : func_get_args(); |
|
| 1519 | ||
| 1520 | foreach ($fieldNames as $fieldName) { |
|
| 1521 | $this->query['select'][$fieldName] = 1; |
|
| 1522 | } |
|
| 1523 | ||
| 1524 | return $this; |
|
| 1525 | } |
|
| 1526 | ||
| 1527 | /** |
|
| 1528 | * Select only matching embedded documents in an array field for the query |
|