Created
March 21, 2013 09:55
-
-
Save srh/5211904 to your computer and use it in GitHub Desktop.
rethinkdb chain insert docs
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('rethinkdb'); | |
var doc = { | |
type: 'user', | |
username: 'test_user_1', | |
firstName: 'one', | |
lastName: 'uno', | |
emailAddress: 'one@test.com', | |
roles: ['user'] | |
} | |
r.connect({host: 'localhost', port: 28015 }, function(err, conn) { | |
function chain_inserts() { | |
r.db('test').table('users').insert(doc).run(conn, function(err, result) { | |
if(err) { | |
throw err; | |
} | |
console.log(result.generated_keys); | |
chain_inserts(); | |
}); | |
} | |
chain_inserts(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment