文档中心 > API类目 > 商家应用云

taobao.miniapp.cloud.mongo.update (更新MongoDB中的数据)

更新MongoDB中的数据

公共参数

请求参数

名称 类型 是否必须 示例值 更多限制 描述
filter Json 必须 {"name":"cx"} 更新条件
collection String 必须 users MongoDB表名
record Json 必须 {"$set" : {"name": "c","age": 18}} 待写入的数据
env String 可选 online 要操作的环境,默认是测试环境

响应参数

名称 类型 示例值 描述
total Number 1 更新的记录数

请求示例

  • JAVA
  • .NET
  • PHP
  • CURL
  • Python
  • C/C++
  • NodeJS
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
MiniappCloudMongoUpdateRequest req = new MiniappCloudMongoUpdateRequest();
req.setFilterString("{\"name\":\"cx\"}");
req.setCollection("users");
req.setRecordString("{\"$set\" : {\"name\": \"c\",\"age\": 18}}");
req.setEnv("online");
MiniappCloudMongoUpdateResponse rsp = client.execute(req);
System.out.println(rsp.getBody());

响应示例

  • XML示例
  • JSON示例
<miniapp_cloud_mongo_update_response>
    <total>1</total>
</miniapp_cloud_mongo_update_response>

异常示例

  • XML示例
  • JSON示例
<error_response>
    <code>50</code>
    <msg>Remote service error</msg>
    <sub_code>isv.invalid-parameter</sub_code>
    <sub_msg>非法参数</sub_msg>
</error_response>

错误码解释

错误码 错误描述 解决方案

API工具

如何获得此API

FAQ

返回
顶部