Terrastore doc update operation

5 views
Skip to first unread message

Julius Somoye

unread,
Jun 7, 2011, 11:26:57 AM6/7/11
to terrastore-discussions
Please I need help executing terrastore update on documents. so far I
have read the docs online saying something about a predefined server
side update functions. I am a newbie as you can tell. Please can
someone show a simple example to change this 'score' on this doc to
'100':

bucket : testbucket
document key : 1
doc:
2: {
name: "ethan"
gender: "male"
score: 456
}


what should the server side merge function look like and how do I
define it on the server?

Is it possible to perform the update on the fly via curl without using
predefined server side function?

Terrastore looks great and I would love to explore it further.

Thanks

Sergio Bossa

unread,
Jun 7, 2011, 3:52:56 PM6/7/11
to terrastore-...@googlegroups.com
Hi Julius,

thanks for your kind words about Terrastore :)

The best way to update your data is by the means of a merge operation,
as follows:

curl -v -X POST -H "Content-Type: application/json" -d
"{\"*\":{\"score\" : 100}}" "http://127.0.0.1:8080/testbucket/1/merge"

The operation above merges your document with the provided update by
replacing the score attribute with the given value.
Merge updates are described in the following wiki pages:
http://code.google.com/p/terrastore/wiki/HTTP_Client_API#Merge_updates
http://code.google.com/p/terrastore/wiki/Developers_Guide#Merge_update

Feel free to hand us any questions about them.
Cheers,

Sergio B.

--
Sergio Bossa
http://www.linkedin.com/in/sergiob

Julius Somoye

unread,
Jun 13, 2011, 6:22:06 AM6/13/11
to terrastore-discussions
Thanks Sergio,

This is very helpful. I am hoping to start an article/tutorial with
sample code just to get most newbies started.

On Jun 7, 8:52 pm, Sergio Bossa <sergio.bo...@gmail.com> wrote:
> Hi Julius,
>
> thanks for your kind words about Terrastore :)
>
> The best way to update your data is by the means of a merge operation,
> as follows:
>
> curl -v -X POST -H "Content-Type: application/json" -d
> "{\"*\":{\"score\" : 100}}" "http://127.0.0.1:8080/testbucket/1/merge"
>
> The operation above merges your document with the provided update by
> replacing the score attribute with the given value.
> Merge updates are described in the following wiki pages:http://code.google.com/p/terrastore/wiki/HTTP_Client_API#Merge_updateshttp://code.google.com/p/terrastore/wiki/Developers_Guide#Merge_update
Reply all
Reply to author
Forward
0 new messages