简体   繁体   中英

sort geonear search results in ruby on rails with mongoid

I am using below query to get search results

Org.where('content.attribs.name'=>'cuisine', 'content.attribs.value'=>cuisine ).geo_near([lon,lat], :max_distance => dist, :spherical => true, num: num_results)

now I want to sort these results by Ratings column in desc order

pls can anybody help

The geoNear command returns a document, and not a cursor, so you can't call sort on that. You will have to do this in your application code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM