> db.createCollection('polygon_test')
{ "ok" : 1 }
> db.polygon_test.createIndex({geometry: '2dsphere'})
{
"createdCollectionAutomatically" : false,
"numIndexesBefore" : 1,
"numIndexesAfter" : 2,
"ok" : 1
}
> db.polygon_test.insert({
... "type": "Feature",
... "properties": {},
... "geometry": {
... "type": "Polygon",
... "coordinates": [
... [
... [
... -92.3262,
... 29.5319
... ],
... [
... -92.3236,
... 29.5314
... ],
... [
... -92.1092,
... 29.5311
... ],
... [
... -92.8126,
... 29.53115
... ],
... [
... -92.3262,
... 29.5319
... ]
... ]
... ]
... }
... })
WriteResult({
"nInserted" : 0,
"writeError" : {
"code" : 16755,
"errmsg" : "Can't extract geo keys: { _id: ObjectId('59d65ac8452ead2f11d5af10'), type: \"Feature\", properties: {}, geometry: { type: \"Polygon\", coordinates: [ [ [ -92.3262, 29.5319 ], [ -92.3236, 29.5314 ], [ -92.1092, 29.5311 ], [ -92.8126, 29.53115 ], [ -92.3262, 29.5319 ] ] ] } } Loop is not valid: [ [ -92.3262, 29.5319 ], [ -92.3236, 29.5314 ], [ -92.1092, 29.5311 ], [ -92.8126, 29.53115 ], [ -92.3262, 29.5319 ] ] Edges 0 and 2 cross. Edge locations in degrees: [-92.3262000, 29.5319000]-[-92.3236000, 29.5314000] and [-92.1092000, 29.5311000]-[-92.8126000, 29.5311500]"
}
})
>