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