May 20, 2021 WeChat Mini Program Development Document
This interface should be called on the server side, as detailed in the service side API.
The database inserts records
POST https://api.weixin.qq.com/tcb/databaseadd?access_token=ACCESS_TOKEN
Property | Type | The default | Required | Description |
---|---|---|---|---|
access_token | string | Is | The interface calls the credentials | |
Env | string | Is | Cloud environment ID | |
query | string | Is | The database action statement |
The returned JSON packet
Property | Type | Description |
---|---|---|
errcode | number | Error code |
errmsg | string | The error message |
id_list | Array.<string> | The primary key of the successfully inserted data collection _id. |
The legal value of errcode
Value | Description | The lowest version |
---|---|---|
0 | The request was successful | |
-1 | System error | |
-1000 | System error | |
40014 | AccessToken is not legal | |
40097 | Request parameter error | |
40101 | Missing required parameters | |
41001 | ACCESSTOKEN | |
42001 | AccessToken expired | |
43002 | HTTP METHOD Error | |
44002 | Post body is empty | |
47001 | POST BODY format is incorrect | |
85088 | The APP is not open for cloud development | |
Other error codes | Cloud development error code |
{
"env":"test2-4a89da",
"query": "db.collection(\"geo\").add({
data: [{
description: \"item1\",
due: new Date(\"2019-09-09\"),
tags: [
\"cloud\",
\"database\"
],
location: new db.Geo.Point(113, 23),
done: false
},
{
description: \"item2\",
due: new Date(\"2019-09-09\"),
tags: [
\"cloud\",
\"database\"
],
location: new db.Geo.Point(113, 23),
done: false
}
]
})"
}
{
"errcode": 0,
"errmsg": "ok",
"id_list": [
"be62d9c4-43ec-4dc6-8ca1-30b206eeed24",
"0f4b8add5cdd728a003bf5c83ed99dff"
]
}
The database action statement syntax is the same as the database API