收藏
回答

云函数修改数据库记录,collection.update:ok,查看数据库就是未更新记录,感谢回答?

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

cloud.init({env:"env-cwh01-q9lg9"})

// 云函数入口函数

const DB = cloud.database();

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

  console.log("事件",event)

  try {

  if(event.option=='add'){

  return await DB.collection('employeeindex')

  .where({

    name:event.name,

    num:event.num,

   })

   .update({

    data:{

      name:event.name,

      department:event.department,

      job:event.job,

      num:event.num,

      performance_index:event.performance_index,

      performance_index_code:event.performance_index_code,

      performance_index_quota:event.performance_index_quota,

      evaluator_department:event.evaluator_department,

      evaluator:event.evaluator,

      performance_index_objective:event.performance_index_objective,

      evaluation_data:event.evaluation_data,

      score:event.score,

      filed:event.filed,

      score_rule:event.score_rule, 

  }

});

}

}catch (e{

  console.error(e)

}

}


  1. result:
  2. errMsg"collection.update:ok"


回答关注问题邀请回答
收藏

1 个回答

  • 陈文辉
    陈文辉
    2021-01-11

    我的数据库记录是通过代码导入数据库的!数据权限也修改了,还是没用

    {

    "read": true,

    "write": true

    }


    2021-01-11
    有用
    回复
登录 后发表内容
问题标签