reql-then
v0.0.3
Published
Promisify ReQL queries
Downloads
5
Readme
ReQL, then
Promisify RethinkDB's ReQL queries. Inspired by rql-promise. Uses the bluebird promise library.
Install
npm install --save rethinkdb reql-then
Usage
var connect = require('reql-then')
, reql = connect({
host: 'localhost',
port: 28015,
db: 'test',
authKey: '',
maxPoolSize: 10
});
// Make a query
var query = r.db('MiddleEarth').table('Wizards').get('Gandalf').update({'colour': 'White'});
reql(query).then(function (result) {
// handle result
}).error(function (err) {
// handle error
}).catch(function (err) {
// handle exception
});
// Disconnect
reql.close().then(function () {
console.log('good bye');
});
Testing
Run tests:
$ npm test
Enable debugging messages (assuming server.js
uses reql-then
):
$ DEBUG=reql-then node server.js