Last active
August 29, 2015 14:14
-
-
Save neumino/d125dee5258494af6818 to your computer and use it in GitHub Desktop.
One new thing with rethinkdbdash 1.16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var r = require('rethinkdbdash')(); | |
var bluebird = require('bluebird'); | |
var assert = require('assert'); | |
bluebird.coroutine(function*() { | |
try { | |
var result = yield r.table('users').get("[email protected]").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