Could you please update the documentation.

0 votes

When using the Storage Service to update documents could you please specify if the document will be added to, modified, or completely overwritten with the JSON string/object that is being used in the call:

Update Document By Key Value With JSON String
Update Document By Id With JSON String
Save Or Update Document By Key Value With JSON String
Update Document By Query With JSON String
Add Or Update Keys With JSON String

For example the JSON in the database is: 
{"emailId":"tokyodan1@gmail.com","expirationdate":"2014-10-23","VERIFIED":"FALSE","restoreCount":"3"}

I want to update ONLY the key/value "VERIFIED":"FALSE" to "VERIFIED":"TRUE". 

So when I call one of the above functions to do that, I want to do it with a short JSON string that contains ONLY the key/value that I want to update instead of the whole long JSON string with all the other KEYS/VALUES. With the current documentation it is VERY unclear which function is the most suited for what I want to do.

asked Aug 26, 2014 in App42 Cloud API-BaaS by huffman (50 points)

1 Answer

0 votes
Hi Huffman,
 
In App42 Storage Service, Save Or Update Document By Key Value With JSON String/Object method will completely overwrite the saved JSON object with passed JSON object in the call. This will get updated only if key with passed value matches the doc. If no match is found, new doc JSON doc is created with JSON value being passed in method call.
 
If you need to modify key/value  in JSON doc you need to call the add or update keys method. For example: If JSON doc is stored like this {"emailId":"tokyodan1@gmail.com","expirationdate":"2014-10-23","VERIFIED":"FALSE","restoreCount":"3"}  with doc/object id as 1234. 
 
You have to pass JSON string as {"VERIFIED":"TRUE" } to modify VERIFIED key for this doc in  add or update keys method. This will also need docId to get passed along with the call.
 
 If suppose document was saved with out VERIFIED key like this {"emailId":"tokyodan1@gmail.com","expirationdate":"2014-10-23","restoreCount":"3"}, in this case it will add this node in the doc.
 

 

We will add more clear examples in all these methods to make it understandable. Thanks a lot for your input. We will update the doc in coming days. Sorry for trouble
answered Aug 26, 2014 by ajay123 (899 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
...