Hello,
I'm very disapointed after five days to try to find a solution to my query problem, I try to update value based on this query :
for (int i = 0; i < mediaCount; i++)
{
string currentVideo = Regex.Match(jsonMedias["media"][i]["video"].ToString(), @".*\/([^/]*)$").Groups[1].Value.ToString().Replace(" ", "");
string videoSelected = Regex.Match(RavrDataManager.Instance.CurrentVideo, @".*\/([^/]*)$").Groups[1].Value.ToString().Replace(" ", "");
// If video url is same of selected video url
if (currentVideo == videoSelected)
{
// Addition old value to new value (+1)
int currentLike;
int.TryParse(jsonMedias["media"][i]["liked"].ToString(), out currentLike);
value = currentLike + 1;
Query q1 = QueryBuilder.Build("media.video", RavrDataManager.Instance.CurrentVideo, Operator.EQUALS); // Build query q1 for key1 equal to video and value1 equal to current video url
Query q2 = QueryBuilder.Build("media.liked", value.ToString(), Operator.NOT_EQUALS); // Build query q2 for key2 equal to liked and value2 less than new value
Query query = QueryBuilder.CompoundOperator(q1, Operator.AND, q2);
// Call storage to update value for key "liked"
storageService.UpdateDocumentByQuery(RavrConstant.dbName, RavrDataManager.Instance.CurrentCountryName, query, jsonString, callBackUpdate);
return;
}
}
is very basic query, I need to update key:"liked" for the current url video seleted
error and debug result are :
apiKeyf51f2393d29c9bc2ad211239076d32a42e58d7c3b9c6782bb560d4f5d9435fa5body{"app42":{"storage":{"jsonQuery":[{"key":"media.video","operator":"$eq","value":"http://s3.amazonaws.com/ravrmedia/Spain/Rafting Spain.mp4"},{"compoundOpt":"$and"},{"key":"media.liked","operator":"$ne","value":"6"}],"jsonDoc":"{"media":[ {"id":"1", "isWtfVideo":"false", "title":"Child Climbs Historic Human Tower", "price":"0", "description":"We are watching, along with thousands of spectators, the success of a challenging old tradition in Vilafranca which is the building of a human tower.", "cityName":"Vilafranca", "isHotelVideo":"false", "liked":"5", "image":"http://s3.amazonaws.com/ravrmedia/Spain/img/Child Climbs Historic Human Tower.jpg", "thumb":"http://s3.amazonaws.com/ravrmedia/Spain/img/Child Climbs Historic Human Tower.jpg", "video":"http://s3.amazonaws.com/ravrmedia/Spain/Child Climbs Historic Human Tower.mp4"}, {"id":"2", "isWtfVideo":"false", "title":"City Guide of Barcelona", "price":"0", "description":"We are being taken on a little guided tour of Barcelona. We discover the Seaside, the Sagrada Família \"a Roman Catholic Church\" Mercado de La Boqueria \"the main market\", Plaça Reial, Passeig de Gràcia (one of the main avenues), La Rambla \"a popular street\", Montjuïc Castle, Torre de Collserola \"a uniquely designed tower\" and Catalonia Square.", "cityName":"Barcelona", "isHotelVideo":"false", "liked":"5", "image":"http://s3.amazonaws.com/ravrmedia/Spain/img/City Guide of Barcelona.jpg", "thumb":"http://s3.amazonaws.com/ravrmedia/Spain/img/City Guide of Barcelona.jpg", "video":"http://s3.amazonaws.com/ravrmedia/Spain/City Guide of Barcelona.mp4"}, {"id":"3", "isWtfVideo":"false", "title":"Hot Air Balloon Flight Spain", "price":"0", "description":"We are being taken on a hot air ballon trip over La Cerdanya.", "cityName":"La Cerdanya", "isHotelVideo":"false", "liked":"5", "image":"http://s3.amazonaws.com/ravrmedia/Spain/img/Hot Air Balloon Flight Spain.jpg", "thumb":"http://s3.amazonaws.com/ravrmedia/Spain/img/Hot Air Balloon Flight Spain.jpg", "video":"http://s3.amazonaws.com/ravrmedia/Spain/Hot Air Balloon Flight Spain.mp4"}, {"id":"4", "isWtfVideo":"false", "title":"Michelin Chef Susi Diaz at La Finca restaurant", "price":"0", "description":"We are watching Susia Diaz, a Michelin Star chef, and her team cooking in her restaurant called La Fincha in Elche.", "cityName":"Elche", "isHotelVideo":"false", "liked":"5", "image":"http://s3.amazonaws.com/ravrmedia/Spain/img/Michelin Chef Susi Diaz at La Finca restaurant.jpg", "thumb":"http://s3.amazonaws.com/ravrmedia/Spain/img/Michelin Chef Susi Diaz at La Finca restaurant.jpg", "video":"http://s3.amazonaws.com/ravrmedia/Spain/Michelin Chef Susi Diaz at La Finca restaurant.mp4"}, {"id":"5", "isWtfVideo":"false", "title":"Rafting Spain", "price":"0", "description":"We are rafting in the Gállego River in Huesca.", "cityName":"Huesca", "isHotelVideo":"false", "liked":"5", "image":"http://s3.amazonaws.com/ravrmedia/Spain/img/Rafting Spain.jpg", "thumb":"http://s3.amazonaws.com/ravrmedia/Spain/img/Rafting Spain.jpg", "video":"http://s3.amazonaws.com/ravrmedia/Spain/Rafting Spain.mp4"}, {"id":"6", "isWtfVideo":"false", "title":"Timelapse City of Arts and Sciences", "price":"0", "description":"We are standing in an outdoors section of L'Oceanogràfic, an oceanarium in Valencia, in time-lapse.", "cityName":"Valencia", "isHotelVideo":"false", "liked":"5", "image":"http://s3.amazonaws.com/ravrmedia/Spain/img/Timelapse City of Arts and Sciences.jpg", "thumb":"http://s3.amazonaws.com/ravrmedia/Spain/img/Timelapse City of Arts and Sciences.jpg", "video":"http://s3.amazonaws.com/ravrmedia/Spain/Timelapse City of Arts and Sciences.mp4"} ]}"}}}collectionNameSpaindbNameRAVRMEDIASsessionId464baa26-7cc2-4534-bbc3-562f073dc2d4timeStamp2016-07-23T11:27:00.940Zversion1.0
UnityEngine.Debug:Log(Object)
com.shephertz.app42.paas.sdk.csharp.App42Log:Console(String)
com.shephertz.app42.paas.sdk.csharp.util.Util:SortAndConvertTableToString(Dictionary`2)
com.shephertz.app42.paas.sdk.csharp.util.Util:Sign(String, Dictionary`2)
com.shephertz.app42.paas.sdk.csharp.storage.StorageService:UpdateDocumentByQuery(String, String, Query, String, App42CallBack)
RavrLikeManager:ProcessMedias(String) (at Assets/_RAVR_V1/Scripts/RavrLikeManager.cs:137)
RavrLikeManager:Update() (at Assets/_RAVR_V1/Scripts/RavrLikeManager.cs:62)
PUT URI : https://api.shephertz.com/cloud/1.0/storage/updateDocsByQuery/dbName/RAVRMEDIAS/collectionName/Spain?
UnityEngine.Debug:Log(Object)
com.shephertz.app42.paas.sdk.csharp.App42Log:Console(String)
com.shephertz.app42.paas.sdk.csharp.connection.RESTConnectorWWW:ExecutePut(String, Dictionary`2, String, Dictionary`2, Dictionary`2, App42CallBack)
com.shephertz.app42.paas.sdk.csharp.storage.StorageService:UpdateDocumentByQuery(String, String, Query, String, App42CallBack)
RavrLikeManager:ProcessMedias(String) (at Assets/_RAVR_V1/Scripts/RavrLikeManager.cs:137)
RavrLikeManager:Update() (at Assets/_RAVR_V1/Scripts/RavrLikeManager.cs:62)
errorValue : {"app42Fault":{"httpErrorCode":400,"appErrorCode":1400,"message":"Bad Request","details":"The Request parameters are invalid"}}
UnityEngine.Debug:Log(Object)
com.shephertz.app42.paas.sdk.csharp.App42Log:Console(String)
com.shephertz.app42.paas.sdk.csharp.connection.<Execute>d__6:MoveNext()
com.shephertz.app42.paas.sdk.csharp.connection.<WaitForRequest>d__3:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
I dont understand where problem com from...
Thanks for help