const db = uniCloud.database();
let res = await db.collection('opendb-poi').aggregate()
.geoNear({
distanceField: 'distance', // 输出的每个记录中 distance 即是与给定点的距离
spherical: true,
near: new db.Geo.Point(longitude.value, latitude.value),
key: 'location', // 若只有 location 一个地理位置索引的字段,则不需填
includeLocs: 'location', // 若只有 location 一个是地理位置,则不需填
})
.end()
支付宝云,微信开发者工具报错如下:
Error: code: 100104, error: (BadValue) Failed to determine whether query system can provide a covered projection :: caused by :: invalid argument in geo near query: type
表中数据如图,地理位置索引也添加了的