Created
May 28, 2019 18:49
-
-
Save cnmoro/18225e76d3ea8f72d4eb621c6794f4d0 to your computer and use it in GitHub Desktop.
MongoDB Convert Geo Fields into GeoJSON
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
db.getCollection('COLL_NAME').find().forEach(function(element) { | |
element.LOCATION = { | |
"type": "Point", | |
"coordinates": [element.LON, element.LAT] | |
}; | |
db.getCollection('COLL_NAME').save(element); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment