以文档中心的内容为例写了一个一模一样的代码,但永远提示geonear is not function
注:已在数据库中设置过字段为地理索引。问题依旧
const db = wx.cloud.database()
const pxgps = db.command
db.collection('shops').where({location: pxgps.geoNear({geometry: db.Geo.Point(this.data.longitude, this.data.latitude),minDistance: 0,maxDistance: 5000,}).get({
success: res => {
let new_data = res.data
let old_data = this.data.products
console.log("old_data:" + old_data)
this.setData({
products: old_data.concat(new_data),
page: page
})
},
})