我列下关键部分代码
let post_Data={
env:"sit-yyyyer-or",
query:"db.collection(\"liveqr_visit\").add({data:[{visitTime:123456}]})"
}
let url="https://api.weixin.qq.com/tcb/databasequery?access_token="+token
let result =await new Promise((resolve,reject)=>{
axios({
method:'post',
url:url,
responseType:'json',
data:post_Data
})
.then(function (res) {
console.log("payload:",res.data)
})
按官方文档,正常的响应应该是
payload:{
"errcode": 0,
"errmsg": "ok",
"id_list": [
"0f4b8add5cdd728a003bf5c83ed99dff"
]
}
但实际的响应控制台打印出来是
payload: {
errcode: 0,
errmsg: 'ok',
pager: { Offset: 0, Limit: 10, Total: 0 },
data: []
}
注意,请求是成功的,但并没有返回主键,显示的新增总数total也是0,并且压根没有id_list字段
你就是这么看文档的?
https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-http-api/database/databaseAdd.html