O'Reilly logo

MongoDB Cookbook by Amol Nayak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Spherical indexes and GeoJSON-compliant data in MongoDB

Before we continue with this recipe, we need to look at the previous recipe to get an understanding of what geospatial indexes are in MongoDB and how to use the 2D indexes. What we did so far was to import the JSON documents in a nonstandard format in the MongoDB collection, create geospatial indexes, and query them. This approach works perfectly fine and in fact, was the only option available until MongoDB 2.4. Version 2.4 of MongoDB supports an additional way to store, index, and query the documents in the collections. There is a standard way to represent geospatial data particularly meant for geodata exchange in JSON, and the specification of GeoJSON mentions it in detail at http://geojson.org/geojson-spec.html ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required