2
我有一个集合,其中每个文档都有一个位置。我需要根据它们到给定起点的距离来排序文档。此外,我希望只有距离出发点的距离不超过一定限度的文件。按照距离给定点的距离对结果进行排序,并通过mongoid中的最大距离对结果进行筛选
我曾尝试以下:
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>