mongoid - Sorting on GeoWithin MongoDB -


so made query:

db.zips.find( { loc : { $geowithin : { $box :[ [ -90 , 30 ] , [ -80 , 40 ] ] } } } )

and here 1 (out of many) outputs:

{ "city" : "apison", "loc" : [ -85.016404, 35.014926 ], "pop" : 1614, "state" : "tn", "_id" : "37302" }

my question how able sort population , limit 10? when try {$sort{pop:1}} errors doesn't know pop, when add {$limit:10} @ end or query doesn't limit 10 entries shows me last column.

any appreciated!

db.zips.find({loc:{$geowithin:{$box:[[-90,30],[-80,40]]}}}).sort({pop:1}).limit(10)


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -