-
Type: Improvement
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 2.4.0-rc3
-
Component/s: Geo
-
Environment:OS X
GeoParser::parseGeoJSONPolygon validates geodata as part of indexing. If a document has a "bad" or unsupported geometry uasserts are thrown like:
uassert(16693, "Exterior shell of polygon is invalid: " + obj.toString(),
exteriorLoop.IsValid());
Resulting in a message like:
{ "singleShard" : "docs/bartleby.local:30000,bartleby.local:30001,bartleby.local:30002", "err" : "Exterior shell of polygon is invalid: { type: \"Polygon\", coordinates: [ [ [ -97.41583300000001, 40.002001 ], [ -97.41782600000001, 40.002024 ], [ -97.425443, 40.002048 ], [ -97.44466199999999, 40.001958 ], [ -97.463285, 40.002047 ], [ -97.51026400000001, 40.001835 ], [ -97.511381, 40.001899 ], [ -97.515308, 40.001901 ], [ -97.767746, 40.001994 ], [ -97.769204, 40.001995 ], [ -97.770776, 40.001977 ], [ -97.77715499999999, 40.002167 ], [ -97.81942600000001, 40.001958 ], [ -97.821496, 40.002002 ], [ -97.82081599999999, 40.350545 ], [ -97.370694, 40.350312 ], [ -97.36868800000001, 40.350392 ], [ -97.36919899999999, 40.00206 ], [ -97.36919899999999, 40.00206 ], [ -97.41583300000001, 40.002001 ] ] ] }", "code" : 16693, "n" : 0, "lastOp" : { "t" : 1363368177, "i" : 78 }, "connectionId" : 234, "ok" : 1
…only the relative geometry document is returned, not the entire document nor the _id field.
Compare to :
db.counties.ensureIndex({"geometry.coordinates": "2d"})
which returns:
{ "singleShard" : "docs/bartleby.local:30000,bartleby.local:30001,bartleby.local:30002", "err" : "geo values have to be numbers :: caused by :: { _id: ObjectId('5143584d73f8e5de6a092549'), type: \"Feature\", properties: { GEO_ID: \"0500000US01001\", STATE: \"01\", COUNTY: \"001\", NAME: \"Autauga\", LSAD: \"County\", CENSUSAREA: 594.436 }, geometry: { type: \"Polygon\", coordinates: [ [ [ -86.496774, 32.344437 ], [ -86.71789699999999, 32.402814 ], [ -86.81491200000001, 32.340803 ], [ -86.890581, 32.502974 ], [ -86.91759500000001, 32.664169 ], [ -86.71339, 32.661732 ], [ -86.714219, 32.705694 ], [ -86.413116, 32.707386 ], [ -86.41117199999999, 32.409937 ], [ -86.496774, 32.344437 ] ] ] } }", "code" : 13026, "n" : 0, "lastOp" : { "t" : 1363368177, "i" : 78 }, "connectionId" : 234, "ok" : 1 }