微信小程序
聚合
# databaseAggregate
本接口应在服务器端调用,详细说明参见服务端API。
数据库聚合
# 请求地址
POST https://api.weixin.qq.com/tcb/databaseaggregate?access_token=ACCESS_TOKEN
# 请求参数
# 返回值
# Object
返回的 JSON 数据包
errcode 的合法值
# 请求数据示例
{
"env":"test2-4a89da",
"query": "db.collection(\"test_collection\").aggregate().match({tags:\"cloud\"}).limit(10).end()"
}
# 返回数据示例
{
"errcode": 0,
"errmsg": "ok",
"data": [
"{\"_id\":\"f77e039f-f1cf-4aa8-bd59-16cbaa91e6ea\",\"location\":{\"type\":\"Point\",\"coordinates\":[{\"$numberDouble\":\"113.0\"},{\"$numberDouble\":\"23.0\"}]},\"done\":false,\"description\":\"learn cloud database\",\"due\":\"2019-09-09\",\"tags\":[\"cloud\",\"database\"]}",
"{\"_id\":\"6bb88938-49ea-42b6-a6f5-ce408970cfc6\",\"due\":\"2019-09-09\",\"tags\":[\"cloud\",\"database\"],\"location\":{\"type\":\"Point\",\"coordinates\":[{\"$numberDouble\":\"113.0\"},{\"$numberDouble\":\"23.0\"}]},\"done\":false,\"description\":\"学习 cloud database\"}",
"{\"_id\":\"51f4f67e-a6a1-4c3e-a50f-827380b8da86\",\"description\":\"学习 cloud database\",\"due\":\"2019-09-09\",\"tags\":[\"cloud\",\"database\"],\"location\":{\"coordinates\":[{\"$numberDouble\":\"113.0\"},{\"$numberDouble\":\"23.0\"}],\"type\":\"Point\"},\"done\":false}",
"{\"_id\":\"ee1d69da-b7ec-4e7a-bc1f-2fae31da4ce0\",\"tags\":[\"cloud\",\"database\"],\"location\":{\"type\":\"Point\",\"coordinates\":[{\"$numberDouble\":\"113.0\"},{\"$numberDouble\":\"23.0\"}]},\"done\":false,\"description\":\"学习 cloud database\",\"due\":\"2019-09-09\"}"
]
}
# 数据库操作语句说明
数据库操作语句语法与数据库 API相同, 聚合操作参考聚合文档