reql-then

Promisify ReQL queries

Usage no npm install needed!

<script type="module">
  import reqlThen from 'https://cdn.skypack.dev/reql-then';
</script>

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