Registry / database / ueberdb2

ueberdb2

JSON →
library5.0.48jsnpmunverified

ueberdb2 is a Node.js library that provides a high-level abstraction layer over various database systems, allowing them to be used as simple key-value stores. It currently stands at version 5.0.48 and generally follows a release cadence driven by bug fixes, dependency updates, and new database support. Key differentiators include its ability to use a cache and buffer for performance optimization, reducing database transaction overhead through bulk writing, and offering a unified API across a wide array of database backends like MySQL, PostgreSQL, MongoDB, Redis, SQLite, Elasticsearch, and SurrealDB. It supports complex JSON objects and provides methods for getting and setting subkeys, making it versatile for diverse data storage needs.

npm install ueberdb2
INSTALL
IMPORT
SIG · UEBERDB2
U
ueberdb2
databasejavascriptv5.0.48
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.

Database
import { Database } from 'ueberdb2';
const { Database } = require('ueberdb2');
While CommonJS `require` still works for the main `ueberdb2` object, `Database` is a named export. For optimal compatibility and TypeScript support, ESM `import` is recommended, especially since v5.
UeberDBInstance
import type { UeberDBInstance } from 'ueberdb2';
Importing types for better type checking in TypeScript projects is good practice. `UeberDBInstance` represents the instance returned by `new Database()`.
DatabaseOptions
import type { DatabaseOptions } from 'ueberdb2';
Use `DatabaseOptions` type for configuring your database connection, ensuring all options are correctly typed.

This quickstart demonstrates initializing a MySQL database, setting and retrieving key-value pairs, accessing subkeys, setting nested subkeys, and using `findKeys` to query patterns. It highlights `async/await` usage and environment variable best practices for credentials.

import { Database } from 'ueberdb2'; import type { DatabaseOptions } from 'ueberdb2'; (async () => { // Example: Using MySQL. Ensure 'mysql2' package is installed: npm install mysql2 const mysqlOptions: DatabaseOptions = { user: process.env.DB_USER ?? 'root', host: process.env.DB_HOST ?? 'localhost', password: process.env.DB_PASSWORD ?? '', database: process.env.DB_DATABASE ?? 'store', engine: 'InnoDB', }; const db = new Database('mysql', mysqlOptions); try { await db.init(); console.log('Database initialized successfully.'); await db.set('myKey', { data: 'someValue', timestamp: Date.now() }); console.log('Set myKey:', await db.get('myKey')); const subValue = await db.getSub('myKey', ['data']); console.log('Get subkey data:', subValue); await db.setSub('myKey', ['nested', 'prop'], 'nestedValue'); console.log('Set nested subkey. Full object:', await db.get('myKey')); console.log('Finding keys matching "myK*":', await db.findKeys('myK*', null)); } catch (error) { console.error('Database operation failed:', error); } finally { await db.close(); console.log('Database connection closed.'); } })();
Debug
Known issues
breakingUeberDB2 v5.x has dropped support for callbacks and is exclusively `async/await` based. All database methods now return Promises. Legacy code using callbacks will break.
fix
Refactor all database interactions to use `await` with the returned Promises or `.then/.catch`.
affects: >=5.0.0
breakingThe minimum supported Node.js version is now 18.0.0. Running `ueberdb2` on older Node.js versions will result in runtime errors.
fix
Upgrade your Node.js environment to version 18.0.0 or higher. Consider using an LTS version for production.
affects: >=5.0.0
breakingDatabase drivers like Elasticsearch and Redis have seen internal client library updates in v5.0.0. Specifically, Elasticsearch uses `@elastic/elasticsearch` v7.17.0, and Redis has updated its client configuration object. Some old database drivers (CrateDB, LevelDB, LMDB) have been dropped.
fix
Review the specific client library documentation for your chosen database if you encounter connection or configuration issues. If using Elasticsearch, ensure you've enabled `migrate_to_newer_schema` option if needed.
affects: >=5.0.0
gotchaDatabase drivers are peer dependencies. `ueberdb2` itself has '0 Dependencies' in its `package.json` to keep the package light. You *must* manually install the corresponding npm package for your chosen database (e.g., `mysql2` for MySQL, `pg` for PostgreSQL, `redis` for Redis) as `ueberdb2` does not install them automatically.
fix
Before initializing a `Database` instance, install the required database driver: `npm install <your-database-driver-package>` (e.g., `npm install mysql2`).
affects: >=1.0.0
gotchaThe `db.init()` method is asynchronous and *must* be awaited before any other database operations are performed. Failing to await `init()` can lead to race conditions or errors as the database connection may not be established.
fix
Always call `await db.init();` and ensure it completes before making `set`, `get`, `findKeys`, etc., calls.
affects: >=5.0.0
Errors
Common errors & fixes
TypeError: ueberdb.Database is not a constructor
Attempting to destructure `Database` from a CommonJS `require('ueberdb2')` without correctly accessing the `Database` property on the default export.
fix
For CommonJS, use `const ueberdb = require('ueberdb2'); const db = new ueberdb.Database(...)`. For ESM, use `import { Database } from 'ueberdb2'; const db = new Database(...)`.
Error: Driver for <database-type> not found or could not be loaded. Please ensure the corresponding npm package is installed.
The npm package for the specified database driver (e.g., `mysql2`, `pg`, `redis`) is not installed in your project's `node_modules`.
fix
Install the required database driver package: `npm install <driver-name>` (e.g., `npm install mysql2`).
UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().
A database operation (e.g., `db.set`, `db.get`, `db.init`) returned a Promise that rejected, but there was no `.catch()` handler or `try...catch` block around the `await` call.
fix
Wrap `await` calls in `try...catch` blocks or chain `.catch()` to handle potential errors from asynchronous database operations.
Error: connect ECONNREFUSED <host>:<port>
The database server is not running, is configured incorrectly, or network connectivity is blocked. This is a common connection error for relational and NoSQL databases.
fix
Verify that your database server is running, reachable from your application host, and that the connection details (host, port, user, password, database name) in your `DatabaseOptions` are correct.
Upgrade
Version history
5.0.48latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
43 hits · last 30 days
node
36
OpenAI (training)
3
Meta
2
Resources