0.1.2 • Published 9 years ago

rethink-driver v0.1.2

Weekly downloads
4
License
UNLICENSED
Repository
github
Last release
9 years ago

rethinkdb-driver

Installation

  1. Install RethinkDB
  2. Download sources from github or with npm npm install rethink-driver
  3. Run npm install in rethink-driver directory

Usage

If you don't provide the connection details, the default details will be used.

var RethinkDB = require('rethink-driver');
var db = new RethinkDB(host, port, dbName);
db.connect(connectedCallback);

function connectedCallback(conn) {
	// ...
}

Overview

Example

var query = db.QueryFactory.Find.create('test_table');
db.executeQuery(query).then(function (result) {
    if (result.hasError()) {
        console.log(result.getError());
        return;
    }

	result.getResultSet().cursor...;
});

Allow to array conversation

db.allowToArrayConversation();

You can access the items from the cursor as an array:

for (result.getResultSet().getList() as item) {
	// ...
}

In some cases it could be totally not useful. That it the reason, why its false by default.

Running the tests

Create a database named rethink_db_test first.

nodejs tests -log=4