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

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -