May 20, 2021 WeChat Mini Program Development Document
This interface should be called on the server side, as detailed in the service side API.
Count the number of collection records or the number of result records corresponding to the statistical query statement
POST https://api.weixin.qq.com/tcb/databasecount?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 |
count | number | The number of records |
The legal value of errcode
Value | Description | The lowest version |
---|---|---|
0 | The request was successful | |
-1 | System error | |
-1000 | System error | |
40014 | AccessToken is illegal | |
40097 | The request parameter is wrong | |
40101 | Required parameters are missing | |
41001 | Missing AccessToken | |
42001 | AccessToken expires | |
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\").where({done:true}).count()"
}
{
"errcode": 0,
"errmsg": "ok",
"count": 3
}
The database action statement syntax is the same as the database API