我有我的mongodb集合名称Flight
源和目标字段。这两个字段都以地理空间索引并以纬度长的格式书写。我正在使用mongomapper从rails控制器中查询它。查询源和目的地与地理空间索引mongodb mongomapper
我想编写一个如下所示的查询。
Result= Flight.where(:source => {'$near' => location_src} , :destination => {'$near' => location_dest})
其中location_src和location_dest是以lat-long格式输入的gui。
但是,当我尝试通过编写Result.first
或Result.all
访问结果时,它说 Mongo::OperationFailure: can't have 2 special fields
。
任何人都可以建议我可能是解决方法吗?
亲切的问候, Amrish。
是的,我读了它。因此,我正在寻找解决方法。我相信,很多人一定会遇到这个问题。 –