Tutorial by Examples

const r = require("rethinkdb"); r.connect({host: 'localhost', port: 28015}, (conn) => console.log(conn)) // Or as a promise let rdb_conn; r.connect({host: 'localhost', port: 28015}).then((conn) => { rdb_conn = conn; }).then(() => { // Continue to use rdb_conn }); ...
r.connect({host: 'localhost', port: 28015}) .then((conn) => { return r.dbList().run(conn); }).then((result) => { // Prints out list of databases on the RethinkDB instance console.log(result); });
r.connect({host: 'localhost', port: 28015}) .then((conn) => { return r.dbCreate("stackoverflow").run(conn); }).then((result) => { console.log(result); });
r.connect({host: 'localhost', port: 28015}) .then((conn) => { return r.db("stackoverflow").tableCreate("examples").run(conn); }).then((result) => { console.log(result); });
r.connect({host: 'localhost', port: 28015}) .then((conn) => { return r.db("stackoverflow").table("examples") .insert({ // If `id` is not set, will automatically generate a UUID id: 1, name: 'Thinker', // Wi...
r.connect({host: 'localhost', port: 28015}) .then((conn) => { // Can also use .get({id: 1}) return r.db("stackoverflow").table("examples").get(1).run(conn) }).then((result) => { console.log(result); })

Page 1 of 1