Skip to content

Instantly share code, notes, and snippets.

@neumino
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neumino/d125dee5258494af6818 to your computer and use it in GitHub Desktop.
Save neumino/d125dee5258494af6818 to your computer and use it in GitHub Desktop.
One new thing with rethinkdbdash 1.16
var r = require('rethinkdbdash')();
var bluebird = require('bluebird');
var assert = require('assert');
bluebird.coroutine(function*() {
try {
var result = yield r.table('users').get("orphee@gmail.com").update(function(user) {
return { age: user("age").add(1) }
});
assert.equal(result.replaced, 1);
}
catch(err) {
// something went wrong, the update failed.
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment