Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ti-rethinkdb-pool

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ti-rethinkdb-pool

A connection pool for RethinkDB.

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

rethinkdb-pool

A Node.JS Connection Pool for RethinkDB that returns promises.

RethinkDB is Actively working on their own connection pool for all the official drivers, which is super great and once that is out you should definitely use that instead of this.

But maybe you're interested in today, not tomorrow. Me too.

Using it is easy:

var r = require('ti-rethinkdb-pool')();

r.pool.run(..your rethinkdb query here..).then(function(res) {
  // do something with the result.
});

It returns a promise which you can consume however you like.

It works great with harmony node's generators & co:

var r = require('ti-rethinkdb-pool');
var co = require('co');

co(function *() {
  var res = yield r.pool.run(r.table('foo'));
  // do something with the result.
});

How does this differ from...

  • rethinkdbdash: We use the official rethinkdb driver.
  • hden's rethinkdb-pool: We return promises and you only have to carry around one r object, not an r and a pool.

Also...

It automatically .toArray()'s cursors, so you should never have to deal with cursors directly, nor have to worry about releasing the pool connection after you are done with the cursor. There is currently no provision if you want to deal with cursors directly, but it looks like the official RethinkDB connection pool will.

This monkeypatches the r namespace, which is definitely a no-no, but is also the cleanest way I could come up with to only pass around one object (r) when making queries.

Options

var r = require('lib/rethinkdb_pool')({
  host: 'localhost',
  port: '28015',
  db: 'test',
  authKey: null,
  min: 2,
  max: 10
});

Keywords

FAQs

Package last updated on 18 Jul 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc