string accessTokenqueryString = $"{{\"env\":\"zunzhi-0goxnji212\", \"query\": \"db.collection(\\\"Test\\\").doc(\\\"TestByClient\\\")" + ".update({data:" + "{"+name+":"+value+"}})\"}";
明明时更新命令,服务器总是返回查询的结果
{"errcode":0,"errmsg":"ok","pager":{"Offset":0,"Limit":10,"Total":1},"data":["{\"Code_OP\":123456,\"Speed_Station1\":168,\"State_OP\":false,\"State_Station1\":false,\"_id\":\"TestByClient\"}"]}
命令语句在小程序里就运行正常,数据值被成功修改
大家帮忙看看什么原因?难道云数据库不能从外部修改么?谢谢!
public static string GetAccessToken()
{
// 通过Get请求获取access_token
HttpWebResponse httpWebResponse = GetRequest("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx017496cac838&secret=51c000bc2fa6e9cb8f71072");
string resultJson = HttpWebResponseToString(httpWebResponse);
var resultObj = DesAnonymousType(resultJson, new { access_token = "", expires_in = "" });
return resultObj.access_token;
}
public static string UpData(string name, string value)
{
string accessToken = GetAccessToken();
string accessTokenqueryString = $"{{\"env\":\"zunzhi-0goxnji21\", \"query\": \"db.collection(\\\"Test\\\").doc(\\\"TestByClient\\\")" + ".update({data:" + "{"+name+":"+value+"}})\"}";
HttpWebResponse httpWebResponse = PostRequest("https://api.weixin.qq.com/tcb/databasequery?access_token=" + accessToken, accessTokenqueryString);
string data = HttpWebResponseToString(httpWebResponse);
return data;
}
TestByClient 是_id?