Installing the JavaScript driver

Before you install a driver: install RethinkDB first.

Looking for another language? See the complete list of client drivers for RethinkDB.

Installation

Prerequisites: The JavaScript driver requires Node.js >= 0.10.0.

Install the driver with npm:

$ npm install rethinkdb

Usage

You can use the drivers from Node.js like this:

$ node
r = require('rethinkdb')
r.connect({ host: 'localhost', port: 28015 }, function(err, conn) {
  if(err) throw err;
  r.db('test').tableCreate('tv_shows').run(conn, function(err, res) {
    if(err) throw err;
    console.log(res);
    r.table('tv_shows').insert({ name: 'Star Trek TNG' }).run(conn, function(err, res)
    {
      if(err) throw err;
      console.log(res);
    });
  });
});

Next steps

Move on to the ten-minute guide and learn how to use RethinkDB.