提交 8a462046 编写于 作者: 雪洛's avatar 雪洛

fix: gitee pr 78

上级 df4304f3
......@@ -3393,8 +3393,8 @@ let res = await db.collection('orders').aggregate()
如需orders关联books,book再关联authors查询,可以在pipeline内再使用lookup
```js
const dbCmd = db.command;
const db = cloud.database()
const dbCmd = db.command
const $ = db.command.aggregate
let res = await db.collection('orders').aggregate()
.lookup({
......@@ -3404,7 +3404,7 @@ let res = await db.collection('orders').aggregate()
},
pipeline: $.pipeline()
.match(
dbCmd .expr($.eq(['$_id', '$$book_id']))
dbCmd.expr($.eq(['$_id', '$$book_id']))
)
.lookup({
from: 'authors',
......@@ -3413,7 +3413,7 @@ let res = await db.collection('orders').aggregate()
},
pipeline: $.pipeline()
.match(
dbCmd .expr($.eq(['$_id', '$$author_id']))
dbCmd.expr($.eq(['$_id', '$$author_id']))
)
.done(),
as: 'authorList'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册