从 excel 文档导入数据后,在数据上创建地理空间索引时出错

Error creating a geospatial index on the data after importing data from an excel doc

我已经从 excel 文档中导入了这些数据。

 {
    "_id" : ObjectId("57440d63a458f726a8f95bfe"),
    "state" : "WEST BENGAL",
    "bank" : "STATE BANK OF INDIA",
    "ifsc" : "SBIN0000001",
    "micr code" : "700002021",
    "branch" : "KOLKATA MAIN",
    "address" : "SAMRIDDHI BHAWAN, 1 STRAND ROAD, KOLKATA 700 001",
    "latlong" : "22.569435,88.342932",
    "latitude" : "22.569435",
    "longitude" : "88.342932",
    "city" : "KOLKATA",
    "district" : "KOLKATA",
    "loc" : [
            "88.34",
            "22.57"
        ]
}

这是我的示例文档。我无法在 loc 上创建地理空间索引。如何创建?

数组的值需要采用特殊格式才能创建二维索引。

Geospatial Indexes

The values of the array may be either arrays, as in [ 55.5, 42.3 ], or embedded documents, as in { lng : 55.5 , lat : 42.3 }.

我可以在以下文档上创建二维索引。我认为您需要重新审视 excel 导入过程。

{
    "_id" : ObjectId("57440d63a458f726a8f95bfe"),
    "state" : "WEST BENGAL",
    "bank" : "STATE BANK OF INDIA",
    "ifsc" : "SBIN0000001",
    "micr code" : "700002021",
    "branch" : "KOLKATA MAIN",
    "address" : "SAMRIDDHI BHAWAN, 1 STRAND ROAD, KOLKATA 700 001",
    "latlong" : "22.569435,88.342932",
    "latitude" : "22.569435",
    "longitude" : "88.342932",
    "city" : "KOLKATA",
    "district" : "KOLKATA",
    "loc" : [
            88.34,
            22.57
        ]
}