@@ 462-475 (lines=14) @@ | ||
459 | * @param array|string $fieldName,... |
|
460 | * @return $this |
|
461 | */ |
|
462 | public function exclude($fieldName = null) |
|
463 | { |
|
464 | if ( ! isset($this->query['select'])) { |
|
465 | $this->query['select'] = []; |
|
466 | } |
|
467 | ||
468 | $fieldNames = is_array($fieldName) ? $fieldName : func_get_args(); |
|
469 | ||
470 | foreach ($fieldNames as $fieldName) { |
|
471 | $this->query['select'][$fieldName] = 0; |
|
472 | } |
|
473 | ||
474 | return $this; |
|
475 | } |
|
476 | ||
477 | /** |
|
478 | * Specify $exists criteria for the current field. |
|
@@ 1435-1448 (lines=14) @@ | ||
1432 | * @param array|string $fieldName,... |
|
1433 | * @return $this |
|
1434 | */ |
|
1435 | public function select($fieldName = null) |
|
1436 | { |
|
1437 | if ( ! isset($this->query['select'])) { |
|
1438 | $this->query['select'] = []; |
|
1439 | } |
|
1440 | ||
1441 | $fieldNames = is_array($fieldName) ? $fieldName : func_get_args(); |
|
1442 | ||
1443 | foreach ($fieldNames as $fieldName) { |
|
1444 | $this->query['select'][$fieldName] = 1; |
|
1445 | } |
|
1446 | ||
1447 | return $this; |
|
1448 | } |
|
1449 | ||
1450 | /** |
|
1451 | * Select only matching embedded documents in an array field for the query |