| @@ 845-856 (lines=12) @@ | ||
| 842 | * @param float $y |
|
| 843 | * @return $this |
|
| 844 | */ |
|
| 845 | public function near($x, $y = null) |
|
| 846 | { |
|
| 847 | if ($x instanceof Point) { |
|
| 848 | $x = $x->jsonSerialize(); |
|
| 849 | } |
|
| 850 | ||
| 851 | if (is_array($x)) { |
|
| 852 | return $this->operator('$near', ['$geometry' => $x]); |
|
| 853 | } |
|
| 854 | ||
| 855 | return $this->operator('$near', [$x, $y]); |
|
| 856 | } |
|
| 857 | ||
| 858 | /** |
|
| 859 | * Add $nearSphere criteria to the expression. |
|
| @@ 871-882 (lines=12) @@ | ||
| 868 | * @param float $y |
|
| 869 | * @return $this |
|
| 870 | */ |
|
| 871 | public function nearSphere($x, $y = null) |
|
| 872 | { |
|
| 873 | if ($x instanceof Point) { |
|
| 874 | $x = $x->jsonSerialize(); |
|
| 875 | } |
|
| 876 | ||
| 877 | if (is_array($x)) { |
|
| 878 | return $this->operator('$nearSphere', ['$geometry' => $x]); |
|
| 879 | } |
|
| 880 | ||
| 881 | return $this->operator('$nearSphere', [$x, $y]); |
|
| 882 | } |
|
| 883 | ||
| 884 | /** |
|
| 885 | * Negates an expression for the current field. |
|