使用MongoDB 2dsphere存储GEOJSON,在某些lat/lng存储上,我不断遇到以下错误:
{
"code": 16755,
"index": 0,
"errmsg": "Can't extract geo keys: { _id: ObjectId('586ff135b79aa00b84181bfb'), name: \"Austin\", slug: \"Austin\", description: \"\", twitter: \"\", facebook: \"\", instagram: \"\", author: ObjectId('57b60fed8620b56af460d5c5'), tags: [], created: new Date(1483731253640), location: { address: \"Austin, TX, United States\", coordinates: [ 30.267153, -97.74306079999997 ], type: \"Point\" }, __v: 0 } longitude/latitude is out of bounds, lng: 30.2672 lat: -97.7431",
"op": {
"name": "Austin",
"slug": "Austin",
"description": "",
"twitter": "",
"facebook": "",
"instagram": "",
"author": "57b60fed8620b56af460d5c5",
"_id": "586ff135b79aa00b84181bfb",
"tags": [
],
"created": "2017-01-06T19:34:13.640Z",
"location": {
"address": "Austin, TX, United States",
"coordinates": [
30.267153,
-97.74306079999997
],
"type": "Point"
},
"__v": 0
}
}
我似乎不明白为什么它不喜欢lat/lng坐标.
以下是我的位置字段模式:
location: {
type: { type: String, default: 'Point' },
coordinates: [Number],
address: String
},
索引为2dsphere
:
storeSchema.index({ location: '2dsphere' });
我能看到的唯一奇怪的事情是错误信息:
longitude/latitude is out of bounds, lng: 30.2672 lat: -97.7431",
lat/lng比我输入的要短——不确定这是否与此有关.