Registry / database / ejdb
library1.2.12-44jsnpmunverified

EJDB (Embedded JSON Database) is a lightweight, embedded NoSQL database engine for Node.js, providing a MongoDB-like query language for local JSON document storage. The `ejdb` npm package specifically provides the Node.js bindings for the first generation EJDB engine. This version, `1.2.12-44`, is stable but officially discontinued and has not been updated in over seven years. The project has entirely transitioned to its successor, `ejdb2_node`, which is a complete rewrite. Users should migrate to `ejdb2_node` for active development, maintenance, and new features, including security updates. EJDB v1.x was designed for Node.js versions >=4.0.0 and focused on providing fast, self-contained, file-based JSON document storage with indexing, without requiring a separate server process. Its release cadence was sporadic, with its last publish seven years ago. Its key differentiator was being a high-performance embedded JSON store suitable for small to medium-scale applications where a full-fledged database server was considered overkill.

npm install ejdb
INSTALL
IMPORT
SIG · EJDB
E
ejdb
databasejavascriptv1.2.12-44
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.

EJDB
const EJDB = require('ejdb')
import EJDB from 'ejdb'
This package exclusively uses CommonJS modules. ESM 'import' syntax is not supported for this version of EJDB.
EJDB.QL
const QL = EJDB.QL
import { QL } from 'ejdb'
The Query Language (QL) utility is a static method accessed directly from the main EJDB object after it has been required.
EJDB.DEFAULT_OPEN_MODE
const { DEFAULT_OPEN_MODE } = EJDB
import { DEFAULT_OPEN_MODE } from 'ejdb'
Constants like DEFAULT_OPEN_MODE are properties of the main EJDB object.

Demonstrates how to initialize EJDB, open a database file, insert a JSON document, and query for data using a MongoDB-like syntax.

const EJDB = require('ejdb'); const db = new EJDB(); async function run() { try { // Open/create a database file named 'my_database.ejdb' // EJDB.DEFAULT_OPEN_MODE includes read/write, create if not exists, and truncate on open if specified. await db.open('my_database.ejdb', EJDB.DEFAULT_OPEN_MODE); console.log('Database opened successfully.'); // Insert a document into the 'users' collection const userDoc = { name: 'John Doe', age: 42, city: 'Sampleville', interests: ['coding', 'reading', 'hiking'] }; const oid = await db.insert('users', userDoc); console.log(`Document inserted with OID: ${oid}`); // Find documents in the 'users' collection where age is greater than 30 // EJDB.QL is used to construct MongoDB-like queries. const query = EJDB.QL('{"age": {"$gt": 30}}'); const cursor = await db.find('users', query); const results = await cursor.toArray(); console.log('Found documents:', results); // Close the database connection await db.close(); console.log('Database closed.'); } catch (err) { console.error('An error occurred:', err); } } run();
Debug
Known issues
breakingThe `ejdb` package is officially discontinued and deprecated. All new development, maintenance, and support efforts have shifted to its successor, `ejdb2_node`. Users should plan to migrate to `ejdb2_node` as soon as possible for continued functionality and security.
fix
Migrate your application to use the `ejdb2_node` package (https://www.npmjs.com/package/ejdb2_node). This will involve code changes as EJDB2 is a complete rewrite.
affects: >=1.2.0
gotchaAs a native Node.js add-on, `ejdb` requires `node-gyp` to compile C++ source code during installation. This process can frequently fail on modern Node.js versions or certain operating systems due to missing build tools (e.g., C++ compilers, Python) or ABI incompatibilities. The package has not been updated in seven years.
fix
Ensure you have the necessary build tools installed for `node-gyp` (e.g., Python 2.7, Visual C++ Build Tools on Windows, `build-essential` on Linux). However, due to deprecation, migration to `ejdb2_node` is the recommended long-term solution, as some versions of `ejdb2_node` offer pre-compiled binaries.
affects: >=1.2.0
gotchaThis package receives no active maintenance, bug fixes, or security updates. Using it in production environments may expose applications to unpatched vulnerabilities or unexpected behavior with newer Node.js versions.
fix
Expeditiously migrate to the `ejdb2_node` package, which is actively maintained and supported by the developers.
affects: >=1.2.0
Errors
Common errors & fixes
Error: `node-gyp` failed to rebuild...
Installation failed because required C++ build tools are missing or incompatible with your Node.js version/OS.
fix
Install `node-gyp` prerequisites (e.g., `npm install -g node-gyp`, then follow its setup instructions for your OS). For long-term stability, migrate to `ejdb2_node`.
TypeError: require is not a function
Attempting to use `require()` in an ES module context (`type: "module"` in `package.json` or `.mjs` file).
fix
Change your file to use CommonJS (`.js` file without `type: "module"`) or refactor your project to use `ejdb2_node` which may offer better ESM compatibility.
Error: Cannot find module 'ejdb'
The package was not installed successfully, or Node.js cannot locate the native binding.
fix
Run `npm install ejdb` again. Check the console output for `node-gyp` errors. If errors persist, ensure build tools are configured or consider migrating to `ejdb2_node`.
Upgrade
Version history
1.2.12-44latest on npm
Audit
Dependencies

No dependency data recorded yet.

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