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