联表查询时使用 _.geoNear
- 发布:2022-08-06 16:03
- 更新:2022-08-08 11:24
- 阅读:370
产品分类: uniCloud/腾讯云
操作步骤:
预期结果:
正常排序并输出结果
正常排序并输出结果
实际结果:
报错
报错
bug描述:
test() {
let loc_data = this.$store.getters['location/data'];
db.collection('xz_store, xz_goods')
.where({
address: {
location: _.geoNear({
geometry: new db.Geo.Point(loc_data.longitude, loc_data.latitude),
minDistance: 1,
maxDistance: 20000
})
}
})
.get()
.then(res => {
console.log({ res });
});
}
上述代码运行后报错
onDBError DATABASE_REQUEST_FAILED errCode: DATABASE_REQUEST_FAILED | errMsg: [FailedOperation] Failed operation. Please check your request, but if the problem persists, contact us.
VM6857 WAService.js:2 Error: errCode: DATABASE_REQUEST_FAILED | errMsg: [FailedOperation] Failed operation. Please check your request, but if the problem persists, contact us.
at vendor.js?t=wechat&s=1659764968795&v=8d63d0a8366cad352d80446f41b574a2:26218(env: Windows,mp,1.06.2208010; lib: 2.24.4)
test() {
let loc_data = this.$store.getters['location/data'];
db.collection('xz_store, xz_goods')
.where({
address: {
// location: _.geoNear({
// geometry: new db.Geo.Point(loc_data.longitude, loc_data.latitude),
// minDistance: 1,
// maxDistance: 20000
// }),
location: _.geoWithin({
centerSphere: [[loc_data.longitude, loc_data.latitude], 20 / 6378.1]
})
}
})
.get()
.then(res => {
console.log({ res });
});
}
上述代码运行正常
res:
result:
code: (...)
data: Array(2)
0: {_id: {…}, open: true, self_delivery: false, address: {…}, description: "豌豆杂酱面", …}
1: {_id: {…}, open: true, self_delivery: false, address: {…}, description: "特色烤肉饭", …}
length: 2
nv_length: (...)
proto: Array(0)
errCode: 0
errMsg: ""
message: (...)
requestId: "182722ca779_68"
systemInfo: []
timeCost: 359
get code: ƒ ()
get message: ƒ ()
proto: Object
proto: Object
proto: Object
1 个回复
DCloud_uniCloud_WYQ
可以导出一个db_init.json给我吗?含这两个表里面第一条数据就行