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

Claus Guttesen kometen at gmail.com
Fri Jul 8 04:53:05 EDT 2011


> If you have any doubt, *always* prefer `db.get()` and `db.save()`. I
> kinda regret having agreed to include `db.update()`. If it's causing
> confusion I will have to remove it.

I changed it to a db.get() and db.save() and it works (using express):

app.post('/users/save', function(req, res) {
	db.get('users', req.body.user.id, function(err, user, meta) {
		user.fname  = req.body.user.fname;
		user.gender = req.body.user.gender;
		db.save('users', req.body.user.id, user);
		res.redirect('/users');
	})

-- 
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