Last active
June 21, 2017 14:54
-
-
Save WillieYang/f854af0459e5ab1e70ac81e205702a0a to your computer and use it in GitHub Desktop.
When using the GeoNear() funcition in Mongoose, cannot get the ideal result(the result is empty)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // But when input the exact the same coordinate of a place I have stored in the database, it would be revealed. | |
| // As for GeoJSON format, the unit of distance is meters. | |
| // GeoJSON Multipoint require 2dsphere: | |
| { | |
| type: "MultiPoint", | |
| coordinates: [ | |
| [ -73.9580, 40.8003 ], | |
| [ -73.9498, 40.7968 ], | |
| [ -73.9737, 40.7648 ], | |
| [ -73.9814, 40.7681 ] | |
| ] | |
| } | |
| // Legacy coordinate pair require 2d index. | |
| { | |
| $near: [ <x>, <y> ], | |
| $maxDistance: <distance in radians> | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment