收藏
回答

云开发数据库根据geoNear统计总数报错?

 const countResult = await db.collection('huowu1111').where({ //数据库'huowu1111'中物品按距离进行排列

          location: _.geoNear({

            geometry: db.Geo.Point(this.data.longitude, this.data.latitude),

            minDistance: 0,

            maxDistance: 50000, //2020.10.25修改,以后要修改搜索1公里以内货物,并在其中筛选出收藏的物品

          }),

          show: true,   //show为false属于用户取消发布

          expireTime: _.gte(expireTime//超过当前时间的不予显示。

        }).count();



VM1309 WAService.js:2 Error: errCode: -502001 database request fail | errMsg: [FailedOperation.Query] (BadValue) $geoNear, $near, and $nearSphere are not allowed in this context

    at new a (VM1309 WAService.js:2)

    at Function.success (VM1309 WAService.js:2)

    at C (VM1309 WAService.js:2)

    at Object.success (VM1309 WAService.js:2)

    at B (VM1309 WAService.js:2)

    at Q (VM1309 WAService.js:2)

    at VM1309 WAService.js:2

    at VM8 asdebug.js:1

    at I (VM8 asdebug.js:1)

    at VM8 asdebug.js:1(env: Windows,mp,1.05.2106250; lib: 2.16.0)

回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容