db.save() vs. db.update()

Claus Guttesen kometen at gmail.com
Tue Jul 5 18:30:57 EDT 2011


Hi.

When saving a new record using db.update() getting the record using
curl has alot more info:

curl "localhost:8098/riak/users/RQC6seqRIKkBNKQt65QMko3W66"
{"props":{"w":"quorum","r":"quorum","big_vclock":50,"old_vclock":86400,"n_val":3,"postcommit":[],"last_write_wins":false,"small_vclock":10,"allow_mult":false,"young_vclock":20,"rw":"quorum","pw":0,"dw":"quorum","linkfun":{"mod":"riak_kv_wm_link_walker","fun":"mapreduce_linkfun"},"name":"users","chash_keyfun":{"mod":"riak_core_util","fun":"chash_std_keyfun"},"basic_quorum":true,"notfound_ok":false,"pr":0,"precommit":[]},"club":"BBIL","mname":"","year":"1967","gender":"male","fname":"Claus","lname":"Guttesen"}%

When doing a db.save() with the same data I get:

curl "localhost:8098/riak/users/RQC6seqRIKkBNKQt65QMko3W66"
{"fname":"Claus","mname":"","lname":"Guttesen","year":"1967","club":"BBIL","gender":"male"}

If I do a db.save() first and then a db.update() the information is
also terse. Why is db.update() more verbose?

I'm using riak-js v. 0.4.0.

My idea was to add more information in addtion to name, club, year
born, gender. But when I edit the user and save it the previous data
gets overwritten. So I changed db.save() to db.update(), saved a new
user and noticed alot more info.

-- 
regards
Claus

When lenity and cruelty play for a kingdom,
the gentler gamester is the soonest winner.

Shakespeare

twitter.com/kometen




More information about the riak-users mailing list