Previously, I wrote down the search method based on the index. For details, see MongoDB's Geospatial index. I haven't completed this yet. I just finished the overall search here.Code, Hitting the ground and writing this article. The find query can only sort poi points by distance based on 2D coordinates. After querying the list, you have to calculate the distance yourself. Actually, developers will definitely think about this, now that the sorting function is available, there must be data at a distance. Refer to these two videos, pretty good, English is not good, listen to many times watching the document, understand: http://www.10gen.com/presentations/mongosf-2011/geospatial-indexing-mongodb http://www.10gen.com/presentations/mongosf2011/wordsquared geonear command, is based on DB command, rather than based on collection of find, that is, it needs to be executed through runcommand. The specific syntax is as follows: DB. runcommand ({geonear: "collectionname", near: [120.123456, 30.654321], num: 10}) explains this command: query the collection of geonear, 10 records closest to the specified point in near, is it easy? Results: {"NS": "POI. collectionname", "near": "1100110000001111110000001111110000001111110000001111", "results": [{"DIS "... Continue reading→