【发布时间】:2017-05-02 23:45:30
【问题描述】:
我正在尝试对 geonear 查询进行 POC,但我得到了
Error: error: {
"ok" : 0,
"errmsg" : "error processing query: ns=zircon.storeTree: GEONEAR field=start maxdist=0.045045 isNearSphere=1\nSort: {}\nProj: {}\n planner returned error: unable to find index for $geoNear query",
"code" : 2
我也创建了我的基本索引。
> db.store.getIndexes();
[
{
"v" : 1,
"key" : {
"_id" : 1
},
"name" : "_id_",
"ns" : "zircon.store"
},
{
"v" : 1,
"key" : {
"point" : "2dsphere"
},
"name" : "point_2dsphere",
"ns" : "zircon.store",
"2dsphereIndexVersion" : 3
},
{
"v" : 1,
"key" : {
"location.Point" : "2dsphere"
},
"name" : "location.Point_2dsphere",
"ns" : "zircon.store",
"2dsphereIndexVersion" : 3
}
]
我的模特是
```json
{
"_id": ObjectId("57b4d4437ab5db070e8cc02d"),
"location": {
"Point": {
"x": 47.629104999999996,
"y": 77.21983919
}
},
"name": "Gulati XX :19",
"createdDate": ISODate("2016-08-17T21:16:51.605Z"),
"modifiedDate": ISODate("2016-08-17T21:16:51.605Z")
}
```
请就我在这里做错了什么提出建议。是什么导致 geonear 仍然无法工作。
【问题讨论】: