html52.com
我爱小程序-开发者交流社区

云开发 geo查询报错?

db.collection('community')
.aggregate()
.geoNear({
distanceField: 'distance', // 输出的每个记录中 distance 即是与给定点的距离
spherical: true,
near: db.Geo.Point(113.3089506, 23.0968251),
key: 'tlocation', // 若只有 location 一个地理位置索引的字段,则不需填
includeLocs: 'tlocation', // 若只有 location 一个是地理位置,则不需填
})
.end()


报错信息:

Error: FailedOperation, (BadValue) error processing query: ns=tnt-8s0waqgok.community limit=100Tree: GEONEAR  field=tlocation maxdist=1.79769e+308 isNearSphere=1
Sort: {}
Proj: { $pt: { $meta: "geoNearPoint" }, $dis: { $meta: "geoNearDistance" } }
Collation: { locale: "simple" }
 planner returned error: unable to find index for $geoNear query (7288dde9-86a8-4cbd-a766-31bce4c37275)


已添加将tlocation添加为索引

已添加将tlocation添加为索引community表结构如下

community表结构如下

community表结构如下

网友回复

stop eating:

填了和填对,是两码事


填了和填对,是两码事

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付