From abdddb0821c7841ed293d56676e9d38d4ac2a961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Izurieta?= Date: Mon, 25 May 2015 16:40:04 -0300 Subject: [PATCH] Add geo_intersects support --- lib/origin/selectable.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/origin/selectable.rb b/lib/origin/selectable.rb index 362cb5c..2c0d62a 100644 --- a/lib/origin/selectable.rb +++ b/lib/origin/selectable.rb @@ -527,6 +527,26 @@ def within_spherical_circle(criterion = nil) end key :within_spherical_circle, :expanded, "$within", "$centerSphere" + # Adds the $geoIntersects selection to the selectable. + # + # @example Add the selection. + # selectable.geo_intersects(location: {"$geometry" => {:type => "Point", :coordinates => [ 1, 2 ]}}) + # + # @example Execute an $geoIntersects in a where query. + # selectable.where( + # :location.geo_intersects => {"$geometry" => {:type => "Point", :coordinates => [ 1, 2 ]}} + # ) + # + # @param [ Hash ] criterion The geoIntersects criterion. + # + # @return [ Selectable ] The cloned selectable. + # + # @since 1.2.0 + def geo_intersects(criterion = nil) + __override__(criterion, "$geoIntersects") + end + key :geo_intersects, :override, "$geoIntersects" + private # Create the standard expression query.