MongoMapper near with maxDistance - Mongo::OperationFailure: geo values have to be numbers:
问题 I'm trying to encapsulate a near query with a maxDistance in a MongoMapper backed model. I must be doing something silly in my query syntax. Model class Site include MongoMapper::Document key :id, Integer key :name, String key :location, Array ensure_index [[:location, '2d']] def self.nearest(center_point, range) where(:location => {'$near' => center_point, '$maxDistance' => range}).all end end Trying to get everything within 200 miles of a point... Site.nearest([-122.0,44.0],200) > Mongo: