saveOrUpdateDocumentByKeyValue issue.

0 votes

Hi. I try to use custom code. 

In tutorial said:
"saveOrUpdateDocumentByKeyValue This key value pair will be searched in the JSON doc stored in the cloud and matching doc will be updated with the new value passed."

I want to update specific keys in whole json document. Icreate JSONObject with updated chunk of data like that:

final JSONObject updatedData= new JSONObject();
 
updatedData.put( Shared.KEY_SENDED_REQUESTS, initiatorSendedRequestsList ); // initiatorSendedRequestsList  JSONArray
updatedData.put( Shared.KEY_USER_ID, mInitiatorId ); // mInitiatorId  String
 
mStorageService.saveOrUpdateDocumentByKeyValue( Shared.DATABASE_NAME, Shared.COLLECTION_FRIENDS, Shared.KEY_USER_ID, mInitiatorId, updatedData);
 
But this method will owerride entire document or completely create new document with just updated data. Why, what i'm doing wrong?
I think i have to use addOrUpdateKeys but StorageService in custm code java sdk doesn't have this method. Why?
 
--------------------------------------------------------------------
 
Ok. Iresolve issue with document overriding by updating App42 Java lib and  replace saveOrUpdateDocumentByKeyValue by addOrUpdateKeys . I think developers should update eclipse sample project. 
But what diffetence between saveOrUpdateDocumentByKeyValue  and updateDocumentByKeyValue, they both override existing document.
 
[ Custom code, Java ]
 
--------------------------------------------------------------------
 
Ia have one more question. Is custom code calls executed in queue? 
Suppose sittuation. Client1 call Func1, and Client2 call Func2.
First execute Func1 and then Func2, or they will be invoked in parallel?
asked Mar 25, 2016 in Cocos2D-X by Kirill Kotov (39 points)
edited Mar 25, 2016 by Kirill Kotov

1 Answer

0 votes
Hi Kirill,

 

It will call parallelly according to the call. However the difference between both method is, in saveOrUpdateDocumentByKeyValue method will add document in case of there is no records against the key value which you passed in method call.

Let me know if you still have any concern.

 

I will be happy to help!!!

 

Regards,

Himanshu Sharma
answered Mar 25, 2016 by hs00105 (2,005 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...