I'm trying to add a 2dsphere
index and run into problems with malformed geometry (using MongoDB 2.6 with 2dsphere index version 2)
The collection contains both documents with Polygon
geometry as documents with MultiPolygon
geometry. Mongo throws a #16755 error (Malformed geometry) a soon as it reaches a document which has a MultiPolygon
geometry. The GeoJSON is correct according to GeoJSONlint.com
Is it allowed to mix geometry types when setting an index?
How do I cope with this issue?
The document which fails looks like this: (I omitted several points for readability. Both polygons are still closing...)
{ "type" : "MultiPolygon", "coordinates" : [ [ [ [ 4.8730935147694279, 51.4125385138567450 ], [ 4.8731073690744831, 51.4124188435040280 ], [ 4.8719363156445858, 51.4121631573312000 ], [ 4.8720931816264326, 51.4120192196300750 ], [ 4.8730935147694279, 51.4125385138567450 ] ] ], [ [ [ 4.9354151466562142, 51.4320525317730240 ], [ 4.9341804433318899, 51.4319519241268350 ], [ 4.9341480860178217, 51.4323138673607550 ], [ 4.9341289343773811, 51.4329459213489240 ], [ 4.9341142802746933, 51.4334292461250870 ], [ 4.9354151466562142, 51.4320525317730240 ] ] ] ] }