RethinkDB with io.js: exploring ES6 generators and the future of JavaScript
rethinkdb.com
rethinkdb.com
However, if someone want the compactness of the second example today, CoffeeScript is another alternative:
conn = undefined
r.connect().then (c) ->
conn = c
r.dbCreate('quake').run(conn)
.then ->
r.db('quake').tableCreate('quakes').run(conn)
.then ->
r.db('quake').table('quakes')
.indexCreate('geometry', geo: true).run(conn)
.then ->
r.db('quake').table('quakes')
.insert(r.http(feedUrl)('features')).run(conn)
.error (err) ->
console.log(err) if err.msg.indexOf('already exists') == -1
.finally ->
conn.close() if conn
(obviously the main benefits with generators aren't concise code, but since the article mentioned conciseness I thought I'd post the CoffeeScript equivalent)(think it'll even have the skinny arrow, the fat one binds `this` too)