JSPM

  • Created
  • Published
  • Downloads 12206
  • Score
    100M100P100Q129629F

Node driver for RethinkDB

Package Exports

  • rethinkdbdash
  • rethinkdbdash/lib/error
  • rethinkdbdash/lib/term.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (rethinkdbdash) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

rethinkdbdash

Wercker status

An attempt for another JavaScript driver for RethinkDB Note: Still in development.

Use

Example wih koa:

var app = require('koa')();
var r = require('rethinkdbdash');

app.use(function *(){
    var connection = yield r.connect();
    var result = yield r.table("foo").get("bar").run(connection);

    this.body = JSON.stringify(result);
});

app.listen(3000);

Example with bluebird:

var Promise = require('blubird');
var r = require('rethinkdbdash');

var run = Promise.coroutine(function* () {
    var connection, result

    try{
        connection = yield r.connect();
    }
    catch(e) {
        console.log(e);
    }

    try{
        result = yield r.table("foo").get("bar").run(connection);
        console.log(JSON.stringify(result, null, 2));
    }
    catch(e) {
        console.log(e);
    }

    connection.close();
})

Note: You have to start node with the --harmony flag.

Install

  • Build node 0.11.10 (checkout v0.11.10-release) from source (binary won't work with node-protobuf (some libraries are not properly linked).
  • Install rethinkdbdash with npm.
npm install rethinkdbdash

Run tests

Update test/config.js if your RethinkDB instance doesn't run on the default parameters.

Run

mocha --harmony-generators

What's different?

  • Promises with bluebird
  • ReqlDriverError instances partially contain the query that leat to the error
  • The query object is built little by little
  • Long backtraces are split on multiple lines
  • Not supported for browser
  • Tested with Node 11.10 - Should work with Node >= 10.4

Roadmap

  • Pool