云数据库lookup的例子调试失败
发布于 5 年前 作者 tao45 9873 次浏览 来自 问答

Aggregate.lookup(object: Object): Aggregate

https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/database/aggregate/Aggregate.lookup.html#%E7%A4%BA%E4%BE%8B

补充说明:

虽然API有提示【支持端:云函数 1.3.0 起】

但第1种用法(1. 相等匹配)是支持在开发者工具的云开发控制台里面调试的,

第2种(2. 自定义连接条件、拼接子查询)却总是出现那个问题

2. 自定义连接条件、拼接子查询

如果需要指定除相等匹配之外的连接条件,或指定多个相等匹配条件,或需要拼接被连接集合的子查询结果,那可以使用如下定义:

 lookup({
  from: <要连接的集合名>,
  let: { <变量1>: <表达式1>, ..., <变量n>: <表达式n> },
  pipeline: [ <在要连接的集合上进行的流水线操作> ],
  as: <输出的数组字段名>
})

为什么提供的2个例子都失败呢?

执行失败

RuntimeError: cannot read property ‘pipeline’ (from line 8, col 17 to line 8, col 25) 6 | order_quantity: ‘$quantity’ 7 | }, > 8 | pipeline: $.pipeline() | ^^^^^^^^ 9 | .match({ 10 | author: ‘author 3’ 11 | })

2 回复

看上去不象是完全照抄例子,因为例子里没有“author”字样。要不自查,要不发代码。

基础库已经修改为:2.10.2

看不懂为什么出错,官方提供的示例啊 555555555

回到顶部