Registry / database / rethinkdb

rethinkdb

JSON →
library2.4.10.post1jsnpmunverified

The RethinkDB JavaScript driver provides programmatic access to RethinkDB, a NoSQL database known for its real-time capabilities via push queries. It is primarily designed for Node.js environments and implements the ReQL query language. The current stable version is 2.4.4. After a period of inactivity from the original creators, the project transitioned to community-driven maintenance under the Linux Foundation, with recent 2.4.x releases (2023-2024) addressing bug fixes and compilation issues. Its key differentiator remains the 'changefeeds' feature, which allows applications to receive real-time updates as data changes. While the official documentation is still available, the release cadence is irregular, reflecting its community-supported status.

npm install rethinkdb
INSTALL
IMPORT
SIG · RETHINKDB
R
rethinkdb
databasejavascriptv2.4.10.post1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

r
const r = require('rethinkdb');
The 'rethinkdb' package exports a single object, typically aliased as 'r', which is the entry point for all ReQL commands and connection functions. ESM import 'import r from "rethinkdb"' may work in modern Node.js environments but CJS is historically dominant.
connect
const r = require('rethinkdb'); r.connect({...})
import { connect } from 'rethinkdb'
The `connect` method is a property of the main `r` object, not a named export. Ensure you import the entire 'rethinkdb' module first.
RethinkDBError
const r = require('rethinkdb'); const { RethinkDBError } = r;
import { RethinkDBError } from 'rethinkdb'
RethinkDB error types are typically accessed as properties of the main `r` object rather than direct named exports. `r.Error` is the base class for all RethinkDB errors.

Demonstrates connecting to RethinkDB, creating a table if it doesn't exist, inserting a document, and fetching all documents.

const r = require('rethinkdb'); async function runExample() { let connection; try { connection = await r.connect({ host: process.env.DB_HOST ?? 'localhost', port: parseInt(process.env.DB_PORT ?? '28015'), db: process.env.DB_NAME ?? 'test', user: process.env.DB_USER ?? 'admin', password: process.env.DB_PASSWORD ?? '' }); // Create a table if it doesn't exist const tableList = await r.db('test').tableList().run(connection); if (!tableList.includes('authors')) { await r.db('test').tableCreate('authors').run(connection); console.log('Table "authors" created.'); } // Insert a document const insertResult = await r.table('authors').insert({ name: 'John Doe', posts: 5 }).run(connection); console.log('Inserted:', insertResult.generated_keys[0]); // Fetch all documents const cursor = await r.table('authors').run(connection); const authors = await cursor.toArray(); console.log('Authors:', authors); } catch (err) { console.error('Error:', err.message); } finally { if (connection) { await connection.close(); console.log('Connection closed.'); } } } runExample();
Debug
Known issues
breakingThe API for the `r.js` ReQL command experienced breaking changes in version 2.4.2. Users relying on this command should review their code.
fix
Consult the RethinkDB 2.4.0 release notes for details on the `r.js` command changes and update usage accordingly.
affects: >=2.4.2
breakingRethinkDB 2.4.x servers are not compatible with 2.3.x or earlier versions when mixed in the same cluster. Mixing versions can lead to cluster instability or data inconsistencies.
fix
Ensure all servers in a cluster are upgraded to 2.4.x before deploying new instances. Avoid running mixed-version clusters for extended periods during upgrades.
affects: >=2.4.0
gotchaThe HTTP connection type provided by the driver is intended only for the RethinkDB web UI and is explicitly stated not to be secure for application use. Using it in production applications is a security risk.
fix
Always use the default TCP connection for applications. The HTTP connection type is planned to be removed from the driver in future versions.
affects: *
breakingWhen upgrading to RethinkDB 2.4.0 from versions 1.16 or earlier, data files will be automatically migrated. However, it is strongly recommended to back up your data files before performing any major version upgrade.
fix
Before upgrading to RethinkDB 2.4.0 or later from older major versions, perform a full backup of all your data files to prevent potential data loss.
affects: >=2.4.0
breakingOn 32-bit platforms and Windows (both 32 and 64-bit), RethinkDB 2.3.5 servers should not be mixed with servers running 2.3.3 or older in the same cluster. This can cause server crashes, especially when using the web UI or accessing system tables.
fix
On affected platforms, ensure a complete cluster upgrade to 2.3.5+ without mixing older versions. On 64-bit Linux/macOS, mixed 2.3.x versions are temporarily tolerated during upgrade.
affects: 2.3.5
Errors
Common errors & fixes
Error: connect ECONNREFUSED 127.0.0.1:28015
The RethinkDB server is not running, or the connection details (host/port) are incorrect.
fix
Ensure the RethinkDB server is running and accessible from your application. Verify the `host` and `port` parameters in your `r.connect()` call match the server's configuration.
RethinkDBError: Table `db.table_name` does not exist.
The specified database or table has not been created in RethinkDB.
fix
Ensure that the database and table exist before attempting to query them. You can use `r.dbCreate('your_db')` and `r.db('your_db').tableCreate('your_table')` to create them programmatically or via the RethinkDB Data Explorer.
TypeError: r.table(...).insert is not a function
A ReQL query command was called without a `run()` method or with incorrect syntax, or the connection object was not passed.
fix
All ReQL queries must be terminated with a `.run(connection, callback)` or `await .run(connection)` call to execute them against the database. Verify your ReQL chain for correct command usage.
Upgrade
Version history
2.4.10.post1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
10
Resources
rethinkdb — npm install rethinkdb · libregistry