Class: Deli::Adapters::Mongoid::Geo

Inherits:
Param show all
Includes:
Param::Geo
Defined in:
lib/deli/adapters/mongoid.rb

Overview

# Match all people with first name Emmanuel using Javascript. { “$where” : “this.first_name == ‘Emmanuel’” }

# Match all people who live in Berlin, where address is embedded. { “addresses.city” : “Berlin” }

# Example queries using symbol h4s to perform more complex criteria. { “title” : { “$all” : [ “Sir” ] } } { “age” : { “$exists” : true } } { “age” : { “$gt” : 18 } } { “age” : { “$gte” : 18 } } { “title” : { “$in” : [ “Sir”, “Madam” ] } } { “age” : { “$lt” : 55 } } { “age” : { “$lte” : 55 } } { “title” : { “$ne” : “Mr” } } { “title” : { “$nin” : [ “Esquire” ] } } { “aliases” : { “$size” : 2 } } { “location” : { “$near” : [ 22.50, -21.33 ] } } { “location” : { “$within” : { “$center” => [ [ 50, -40 ], 1 ] } } } 3rd number can be a radius: “22.50,-21.33,7”

  • if not null, if null

Instance Attribute Summary

Attributes inherited from Param

#controller, #default, #exact, #key, #model_name, #namespace

Instance Method Summary collapse

Methods included from Param::Geo

#parse

Methods inherited from Param

#render_value

Methods inherited from Param

#initialize, #inspect, #parse, #parse_value

Constructor Details

This class inherits a constructor from Deli::Param

Instance Method Details

#render(value) ⇒ Object



174
175
176
# File 'lib/deli/adapters/mongoid.rb', line 174

def render(value)
  {"$near" => parse(value).reverse}
end