| @@ 859-870 (lines=12) @@ | ||
| 856 | * @param float $y |
|
| 857 | * @return $this |
|
| 858 | */ |
|
| 859 | public function near($x, $y = null) |
|
| 860 | { |
|
| 861 | if ($x instanceof Point) { |
|
| 862 | $x = $x->jsonSerialize(); |
|
| 863 | } |
|
| 864 | ||
| 865 | if (is_array($x)) { |
|
| 866 | return $this->operator('$near', ['$geometry' => $x]); |
|
| 867 | } |
|
| 868 | ||
| 869 | return $this->operator('$near', [$x, $y]); |
|
| 870 | } |
|
| 871 | ||
| 872 | /** |
|
| 873 | * Add $nearSphere criteria to the expression. |
|
| @@ 885-896 (lines=12) @@ | ||
| 882 | * @param float $y |
|
| 883 | * @return $this |
|
| 884 | */ |
|
| 885 | public function nearSphere($x, $y = null) |
|
| 886 | { |
|
| 887 | if ($x instanceof Point) { |
|
| 888 | $x = $x->jsonSerialize(); |
|
| 889 | } |
|
| 890 | ||
| 891 | if (is_array($x)) { |
|
| 892 | return $this->operator('$nearSphere', ['$geometry' => $x]); |
|
| 893 | } |
|
| 894 | ||
| 895 | return $this->operator('$nearSphere', [$x, $y]); |
|
| 896 | } |
|
| 897 | ||
| 898 | /** |
|
| 899 | * Negates an expression for the current field. |
|