I have source and destination fields in my mongodb collection named Flight
. Both the fields are geospatially indexed and written in lat-long format. I am using mongomapper to query it from rails controller.
I want to write a query like following.
Result= Flight.where(:source => {'$near' => location_src} , :destination => {'$near' => location_dest} )
where location_src and location_dest are gui inputs in lat-long format.
However, when I try to access the Result by writing Result.first
or Result.all
, it says that
Mongo::OperationFailure: can't have 2 special fields
.
Can anyone suggest me what could be the workaround?
Kind Regards, Amrish.