咸虾米
咸虾米
  • 发布:2025-08-25 23:31
  • 更新:2025-08-25 23:31
  • 阅读:25

【报Bug】阿里云服务空间,使用JQL查询地理位置在field内使用JQL运算符arrayElemAt会报错

分类:uniCloud

产品分类: uniCloud/App

示例代码:
async demo() {  
    let { data } = await dbJQL  
        .collection('JLJ-merchant-list')  
        .where({  
            location: dbCmd.geoNear({  
                geometry: new dbJQL.Geo.Point(116.98737, 36.67789),  
                maxDistance: 200000  
            })  
        })  
        .field(`_id,arrayElemAt(area,1) as code`)  
        .get();  
    return data;  
}

操作步骤:

运行上面代码,就会报错,如果去掉where条件,在field内是可以使用arrayElemAt运算方法的

预期结果:

查询数组内的第2个项

实际结果:

arrayElemAt查不出数组内的第二项

bug描述:

阿里云服务空间,使用JQL查询地理位置在field内使用JQL运算符arrayElemAt会报错。
Error: Command failed with error 2 (BadValue): '$geoNear, $near, and $nearSphere are not allowed in this context' on server 172.28.211.214:3717. The full response is { "operationTime" : { "$timestamp" : { "t" : 1756135564, "i" : 9 } }, "ok" : 0.0, "errmsg" : "$geoNear, $near, and $nearSphere are not allowed in this context", "code" : 2, "codeName" : "BadValue", "$clusterTime" : { "clusterTime" : { "$timestamp" : { "t" : 1756135564, "i" : 9 } }, "signature" : { "hash" : { "$binary" : "eTVE6D0hjp/LPtZui3jq2U2Vxpg=", "$type" : "00" }, "keyId" : { "$numberLong" : "7492094857553379333" } } } }
23:26:19.827 [本地运行] at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

2025-08-25 23:31 负责人:无 分享
已邀请:

要回复问题请先登录注册