请问有这样在云函数中能自定义collection("数据库名")中变量名的类似方法吗
报错示范(
外部调用此云函数{
//部分主要代码
const db = cloud.database()
exports.main = async (event, context) => {
var DB=event.tempDatabase
return await Database.collection(`${DB}`).count()
}
}
)
控制台报错
VM5044 WAService.js:2 Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID 21e15eb2-cd5a-4185-b4b7-3cd7feb7fb40, cloud function service error code -504002, error message Error: collection.add:fail -502005 database collection not exists. [ResourceNotFound] Db or Table not exist. Please check your request, but if the problem cannot be solved, contact us.