Module: Mongoid::Criterion::Inclusion

Defined in:
lib/mongoid/geo/criterion/inclusion.rb

Instance Method Summary collapse

Instance Method Details

#nearSphere(attributes = {}) ⇒ Criteria

Adds a criterion to the Criteria that specifies values to do geospacial searches by. The field must be indexed with the ā€œ2dā€ option.

Examples:

Adding the criterion.

criteria.near(:field1 => [30, -44])

Parameters:

  • attributes (Hash) (defaults to: {})

    The fields with lat/long values.

Returns:

  • (Criteria)

    A new criteria with the added selector.



14
15
16
# File 'lib/mongoid/geo/criterion/inclusion.rb', line 14

def nearSphere(attributes = {})
  update_selector(attributes, "$nearSphere")
end