调用云函数删除数据库,调用成功却并没有删除掉 是什么原因?
发布于 5 年前 作者 funa 4692 次浏览 来自 问答

// 使用了 async await 语法

const cloud = require('wx-server-sdk')

cloud.init({

 

  env: 'test-7g0nfgf97ff825fd',

} )



const db = cloud.database()

const _ = db.command


exports.main = async (event, context) => {

  const ap = cloud.getWXContext()

  try {

    

    return await db.collection('shopping_cart').where({

      _openid:ap.OPENID,

      product_checked:"true"

    }).remove()

  

  } catch(e{

    console.error(e)

  }

}



1 回复

赔我眼睛,瞎了。云函数返回结果给一下

回到顶部