In case you are unfamiliar with the geospatial stuff, have a look at this introduction to geospatial indexing and searching with MongoDB.
In version 2.4 MongoDB introduces support for a subset of GeoJSON geometries. These geometries can be used both as data and query expressions.
GeoJSON
GeoJSON is a specification for describing geometrical shapes with the help of the JSON (JavaScript Object Notation) format. The basic shapes are points, line strings, polygons and compositions of these shapes. Here are some examples:
// a Point object { type: "Point", coordinates: [0.5, 0.5] } // a LineString object { type: "LineString", coordinates: [ [100.0, 0.0], [101.0, 1.0] ] } // a simple Polygon object, a box { "type": "Polygon", "coordinates": [ [ [0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0], [0.0, 0.0] ] ] } |
GeoJSON Support in MongoDB
Prior to version 2.4 geospatial data in MongoDB was solely points. You were able to index points denoted by a two-dimensional array ( [1,2] ) or an embedded document with two fields ( {x:1, y:2} ). By using GeoJSON geometries you …
(read more…)
category:
English
Deutsch