1***@qq.com
1***@qq.com
  • 发布:4 天前
  • 更新:2 天前
  • 阅读:38

【报Bug】联表查询时,使用geoNear报错

分类:uniCloud

产品分类: uniCloud/腾讯云

操作步骤:

联表查询时使用 _.geoNear

预期结果:

正常排序并输出结果

实际结果:

报错

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

4 天前 负责人:无 分享
已邀请:
DCloud_UNI_WYQ

DCloud_UNI_WYQ

可以导出一个db_init.json给我吗?含这两个表里面第一条数据就行

要回复问题请先登录注册