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