【发布时间】:2014-11-13 20:59:10
【问题描述】:
我有一个集合,其中每个文档都有一个位置。我需要按文档到给定起点的距离对文档进行排序。此外,我只想拥有与起点的距离不超过一定限制的文档。
我尝试了以下方法:
Store.geo_near([32,32]).where(:geo_near_distance.lt => 2)
# all docs whose location are at most 2 from [32, 32]
以上导致如下错误:
NoMethodError: undefined method `where' for #<Mongoid::Contextual::GeoNear:0x438fb70>
【问题讨论】:
标签: ruby-on-rails ruby mongodb mongoid