代码大致如下 返回的result为空,没有返回刚刚添加的那条记录
谢谢解答
exports.main = async (event, context) => {
try {
var res = await db.collection('table1').add({
data: {
***
}
});
if (res.data._id) {
await db.collection('table2')
.where({
_id: event.id
})
.remove();
return await db.collection('table1')
.where({
_id: res.data._id})
.get();
} else {
return "error";
}
} catch (err) {
return err;
}
}