小编apo*_*her的帖子

Mongodb错误:无法从对象,格式错误的几何体中提取地理位置键?

我用mongodb 2.4.3得到以下错误

Can't extract geo keys from object, malformed geometry?

{type: "Polygon",
coordinates: [
    [
        [
            103.8324334524412,
            1.284232321447769
        ],
        [
            103.8342325475588,
            1.284232321447769
        ],
        [
            103.8342325469261,
            1.282433678236006
        ],
        [
            103.8324334530738,
            1.282433678236006
        ]
    ]
]}
Run Code Online (Sandbox Code Playgroud)

有人能帮助我理解这个问题吗?它看起来像一个有效的geoJSON对象.我的索引是类型的2dsphere.

我正在运行的两个步骤是:

collection.ensureIndex {'geometry' : "2dsphere"}, (error) =>
  # some error checking
  # and then
  collection.insert features, (error) =>
    # features is an array of geoJSON feature objects
    # {"type" : "Feature"
    #  "geometry" : <the Polygon object above>
      }
Run Code Online (Sandbox Code Playgroud)

insert查询会出现此错误.我想插入的完整文档是:

{
    "type":"Feature",
    "geometry": { …
Run Code Online (Sandbox Code Playgroud)

mongodb

6
推荐指数
1
解决办法
5204
查看次数

标签 统计

mongodb ×1