const cloud = require('wx-server-sdk') cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV }) const db = cloud.database({ // 该参数从 wx-server-sdk 1.7.0 开始支持,默认为 true,指定 false 后可使得 doc.get 在找不到记录时不抛出异常 throwOnNotFound: false }) const _ = db.command exports.main = async (event) => { try { const result = await db.runTransaction(async transaction => { const aaaRes = await transaction.collection('user').doc('0ec685215e4123840d564a5670623594').get() console.log(aaaRes); if (aaaRes) { console.log(`transaction succeeded`, result) // 会作为 runTransaction resolve 的结果返回 return { aaaAccount: aaaRes.data.amount - 10, } } else { // 会作为 runTransaction reject 的结果出去 await transaction.rollback(-100) } }) return { success: true, aaaAccount: result.aaaAccount, } } catch (e) { console.error(`transaction error`, e) return { success: false, error: e } } }
如何解决云开发事务出现Bad Request?[图片] 环境信息: appid:wx9295da4ab31566e9 envid:tema-dev envid:qiyi-dev 两个环境都不行
2020-02-13解决没,我也有这样的问题
为什么用官方事务的例子也会不行的?(多文档事务不能在分片群集中运行){"success":false,"error":{"errCode":-502001,"errMsg":"document.get:fail [FailedOperation] (Location50841) Multi-document transactions cannot be run in a sharded cluster.; at document.get api; "}}
2020-02-12环境 qiyi-dev 也不行了
为什么用官方事务的例子也会不行的?(多文档事务不能在分片群集中运行)环境 tema-dev [图片]
2020-02-12