写了一个测试添加数据的云函数,本地测试可以添加到云数据库中,而上传云端调用,却没有添加进去?
发布于 5 年前 作者 eshao 13122 次浏览 来自 官方Issues

// 云函数入口文件

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

cloud.init(

{

//开启环境

traceUser: true

}


const db = cloud.database()

// 云函数入口函数

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

dataJson = {

"modelid": 11,

"name": 11,

"phone": 332,

"postid": 11,

"registerTime": 11,

"remarks": 11,

"right": 55,

"sex": 1,

"unitid": "shsshe什么"

}

db.collection('register').add({

// data 字段表示需新增的 JSON 数据

data: dataJson

})

.then(res => {

//console.log(res)

//return res._id

})



2 回复

请大神释疑!

回到顶部