[SERVER-8992] uasserts in GeoParser::parseGeoJSONPolygon don't return _id for document in error Created: 15/Mar/13  Updated: 11/Jul/16  Resolved: 29/Aug/13

Status: Closed
Project: Core Server
Component/s: Geo
Affects Version/s: 2.4.0-rc3
Fix Version/s: 2.5.3

Type: Improvement Priority: Minor - P4
Reporter: Ed Costello Assignee: Matt Kangas
Resolution: Done Votes: 0
Labels: pull-request
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

OS X


Participants:

 Description   

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
}



 Comments   
Comment by auto [ 29/Aug/13 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@10gen.com'}

Message: SERVER-8992 Better error for invalid polygon

Signed-off-by: Matt Kangas <matt.kangas@10gen.com>
Branch: master
https://github.com/mongodb/mongo/commit/9436f8fe392cbd1bb3920fb627ec614853dfcb10

Generated at Thu Feb 08 03:19:00 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.