data.forEach(item=>{
var cut = await db.collection("site_cut").where({ unionId: item._id }).count()
var url = await db.collection("site_url").where({ unionId: item._id }).count()
item.cut = cut.total
item.url = url.total
})
uniCloud 云函数 运行报错:
[design/ac141e111623727925132142066/16ms/ERROR] Unexpected identifier
/tmp/function/__index.js:17
var cut = await db.collection("site_cut").where({ unionId: item._id }).count()
^^
对比官方的写法核对了好几遍 发现并没有书写错误啊
麻烦问下 错误是什么?
1 个回复
wosinkong (作者) - 酷爱编程
for(let item of data) {
item.cut = (await db.collection("site_cut").where({unionId: item._id}).count()).total
item.url = (await db.collection("site_url").where({unionId: item._id}).count()).total
}
已解决