> db.createCollection('xx')
{ "ok" : 1 }
> db.xx.createIndex({geolocation:'2dsphere'})
{
"numIndexesBefore" : 1,
"numIndexesAfter" : 2,
"createdCollectionAutomatically" : false,
"ok" : 1
}
> db.xx.insertOne({'_id': 'busted', geolocation: {'type': 'Polygon', 'coordinates': [[[101.5625,-45.25],[76.5625,-45.25],[82.1875,-45.75],[89.6875,-45.75],[101.5625,-45.25]]]}})
WriteError({
"index" : 0,
"code" : 16755,
"errmsg" : "Can't extract geo keys: { _id: \"busted\", geolocation: { type: \"Polygon\", coordinates: [ [ [ 101.5625, -45.25 ], [ 76.5625, -45.25 ], [ 82.1875, -45.75 ], [ 89.6875, -45.75 ], [ 101.5625, -45.25 ] ] ] } } Loop is not valid: [ [ 101.5625, -45.25 ], [ 76.5625, -45.25 ], [ 82.1875, -45.75 ], [ 89.6875, -45.75 ], [ 101.5625, -45.25 ] ] Edges 0 and 2 cross. Edge locations in degrees: [-45.2500000, 101.5625000]-[-45.2500000, 76.5625000] and [-45.7500000, 82.1875000]-[-45.7500000, 89.6875000]",
"op" : {
"_id" : "busted",
"geolocation" : {
"type" : "Polygon",
"coordinates" : [
[
[
101.5625,
-45.25
],
[
76.5625,
-45.25
],
[
82.1875,
-45.75
],
[
89.6875,
-45.75
],
[
101.5625,
-45.25
]
]
]
}
}
}) :
WriteError({
"index" : 0,
"code" : 16755,
"errmsg" : "Can't extract geo keys: { _id: \"busted\", geolocation: { type: \"Polygon\", coordinates: [ [ [ 101.5625, -45.25 ], [ 76.5625, -45.25 ], [ 82.1875, -45.75 ], [ 89.6875, -45.75 ], [ 101.5625, -45.25 ] ] ] } } Loop is not valid: [ [ 101.5625, -45.25 ], [ 76.5625, -45.25 ], [ 82.1875, -45.75 ], [ 89.6875, -45.75 ], [ 101.5625, -45.25 ] ] Edges 0 and 2 cross. Edge locations in degrees: [-45.2500000, 101.5625000]-[-45.2500000, 76.5625000] and [-45.7500000, 82.1875000]-[-45.7500000, 89.6875000]",
"op" : {
"_id" : "busted",
"geolocation" : {
"type" : "Polygon",
"coordinates" : [
[
[
101.5625,
-45.25
],
[
76.5625,
-45.25
],
[
82.1875,
-45.75
],
[
89.6875,
-45.75
],
[
101.5625,
-45.25
]
]
]
}
}
})
WriteError@src/mongo/shell/bulk_api.js:465:48
mergeBatchResults@src/mongo/shell/bulk_api.js:871:49
executeBatch@src/mongo/shell/bulk_api.js:940:13
Bulk/this.execute@src/mongo/shell/bulk_api.js:1182:21
DBCollection.prototype.insertOne@src/mongo/shell/crud_api.js:264:9
@(shell):1:1