| @@ 871-882 (lines=12) @@ | ||
| 868 | * @param float $y |
|
| 869 | * @return $this |
|
| 870 | */ |
|
| 871 | public function near($x, $y = null) |
|
| 872 | { |
|
| 873 | if ($x instanceof Point) { |
|
| 874 | $x = $x->jsonSerialize(); |
|
| 875 | } |
|
| 876 | ||
| 877 | if (is_array($x)) { |
|
| 878 | return $this->operator('$near', ['$geometry' => $x]); |
|
| 879 | } |
|
| 880 | ||
| 881 | return $this->operator('$near', [$x, $y]); |
|
| 882 | } |
|
| 883 | ||
| 884 | /** |
|
| 885 | * Add $nearSphere criteria to the expression. |
|
| @@ 897-908 (lines=12) @@ | ||
| 894 | * @param float $y |
|
| 895 | * @return $this |
|
| 896 | */ |
|
| 897 | public function nearSphere($x, $y = null) |
|
| 898 | { |
|
| 899 | if ($x instanceof Point) { |
|
| 900 | $x = $x->jsonSerialize(); |
|
| 901 | } |
|
| 902 | ||
| 903 | if (is_array($x)) { |
|
| 904 | return $this->operator('$nearSphere', ['$geometry' => $x]); |
|
| 905 | } |
|
| 906 | ||
| 907 | return $this->operator('$nearSphere', [$x, $y]); |
|
| 908 | } |
|
| 909 | ||
| 910 | /** |
|
| 911 | * Negates an expression for the current field. |
|