const db = cloud.database()db.collection(‘orders’).aggregate() .lookup({ from: ‘books’, localField: ‘book’, foreignField: ‘title’, as: ‘bookList’, }) .end() .then(res => console.log(res)) .catch(err => console.error(err))
根据示例改造
db.collection(‘PRODUCT_TYPE’).aggregate({})
.lookup({
from: ‘PRODUCT_LIST’,
localField: ‘code’,
foreignField: ‘type’,
as: ‘productList’,
})
.end()
.then(res => console.log(res))
.catch(err => console.error(err))
无法使用
报错
VM167:1 Error: errCode: -502003 database permission denied | errMsg: Permission denied
at new u (WAService.js:1)
at Function.success (WAService.js:1)
at Object.success (WAService.js:1)
at r (WAService.js:1)
at WAService.js:1
at v (WAService.js:1)
at WAService.js:1
at t.<anonymous> (VM181 asdebug.js:1)
at WAService.js:1
at WAService.js:1