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 updates the record
POST https://api.weixin.qq.com/tcb/databaseupdate?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 | illustrate |
---|---|---|
errcode | number | error code |
errmsg | string | Error message |
matched | number | Update condition matches the result number |
modified | number | Modified record number, Note: Use the SET to operate the newly inserted data is not included in the number of modifications |
id | string | Newly inserted ID, Note: This field will be valued only when using the set operation. |
Errcode's legitimate value
value | illustrate | Minimum version |
---|---|---|
0 | Request success | |
-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 Error | |
85088 | The APP has not opened the cloud development | |
Other error code | Cloud development error code |
{
"env":"test2-4a89da",
"query": "db.collection(\"geo\").where({age:14}).update({data:{age: _.inc(1)}})"
}
{
"errcode": 0,
"errmsg": "ok",
"matched": 1,
"modified": 1,
"id": ""
}
{
"env":"test2-4a89da",
"query": "db.collection(\"geo\").doc(\"56abd6d5-9daf-4fc7-af05-eca13933f1aa\").update({data:{age: 10}})"
}
{
"errcode": 0,
"errmsg": "ok",
"matched": 1,
"modified": 1,
"id": ""
}
{
"env":"test2-4a89da",
"query": "db.collection(\"geo\").doc(\"be62d9c4-43ec-4dc6-8ca1-30b206eeed24\").set({data: {
description: \"set\",
done: true
}})"
}
{
"errcode": 0,
"errmsg": "ok",
"matched": 0,
"modified": 0,
"id": "be62d9c4-43ec-4dc6-8ca1-30b206eeed24"
}
The database action statement syntax is the same as the database API