- 当前 Bug 的表现(可附上截图)
- 预期表现
- 复现路径
- 提供一个最简复现 Demo
我存坐标的字段时 loc,已添加了索引
请问要使用geoNear ,那么字段是否要做特殊索引
返回结果:
{"errorCode":1,"errorMessage":"user code exception caught","stackTrace":"errCode: -502001 database request fail | errMsg: [FailedOperation.Query] (BadValue) failed on: cmgo-74jngqhb_0 :: caused by :: error processing query: ns=tnt-69ax8l27s.usersTree: GEONEAR field=loc maxdist=1.79769e+308 isNearSphere=0\nSort: {}\nProj: {}\n planner returned error: unable to find index for $geoNear query; "}
日志:
START RequestId: 1024d995-6734-11e9-b8ec-525400681fe1
Event RequestId: 1024d995-6734-11e9-b8ec-525400681fe1
2019-04-25T08:28:11.839Z 1024d995-6734-11e9-b8ec-525400681fe1 { latitude: 25.030724, longitude: 121.520076 }
Error: errCode: -502001 database request fail | errMsg: [FailedOperation.Query] (BadValue) failed on: cmgo-74jngqhb_0 :: caused by :: error processing query: ns=tnt-69ax8l27s.usersTree: GEONEAR field=loc maxdist=1.79769e+308 isNearSphere=0
Sort: {}
Proj: {}
planner returned error: unable to find index for $geoNear query;
at new CloudSDKError (/var/user/node_modules/wx-server-sdk/index.js:6166:28)
at Object.returnAsCloudSDKError (/var/user/node_modules/wx-server-sdk/index.js:6218:16)
at Object.checkError (/var/user/node_modules/wx-server-sdk/index.js:1484:23)
at Query.<anonymous> (/var/user/node_modules/wx-server-sdk/index.js:1550:41)
at step (/var/user/node_modules/tslib/tslib.js:133:27)
at Object.next (/var/user/node_modules/tslib/tslib.js:114:57)
at fulfilled (/var/user/node_modules/tslib/tslib.js:104:62)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
END RequestId: 1024d995-6734-11e9-b8ec-525400681fe1
Report RequestId: 1024d995-6734-11e9-b8ec-525400681fe1 Duration:53ms Memory:256MB MaxMemoryUsed:1.234375MB