May 20, 2021 WeChat Mini Program Development Document
This interface should be called on the server side, as detailed in the service side API.
Change the database index
POST https://api.weixin.qq.com/tcb/updateindex?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 | |
collection_name | string | Is | The name of the collection | |
create_indexes | Array.<Object> | Is | New index | |
drop_indexes | Array.<Object> | Is | Delete the index |
create_indexes structure of the system
Property | Type | The default | Required | Description |
---|---|---|---|---|
name | string | Is | The index name | |
unique | boolean | Is | Whether it's unique or not | |
keys | Array.<Object> | Is | Index field |
The structure of keys
Property | Type | The default | Required | Description |
---|---|---|---|---|
name | string | Is | The field name | |
direction | string | Is | The fields are sorted |
The legal value of the direction
Value | Description | The lowest version |
---|---|---|
"1" | Ascending | |
"-1" | Descending | |
"2dsphere" | Location |
drop_indexes structure of the system
Property | Type | The default | Required | Description |
---|---|---|---|---|
name | string | Is | The index name |
The returned JSON packet
Property | Type | Description |
---|---|---|
errcode | number | Error code |
errmsg | string | The error message |
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",
"collection_name": "counters",
"create_indexes": [
{
"name":"add_index",
"unique": true,
"keys": [
{
"name": "test",
"direction": "2dsphere"
}
]
}
],
"drop_indexes": [
{
"name":"del_index"
}
]
}
{
"errcode": 0,
"errmsg": "ok",
}