Registry / database / slayer.db

slayer.db

JSON →
library1.5.11jsnpmunverified

Slayer.DB is a lightweight, easy-to-use database module for Node.js offering two backends: JSON-file-based (slayersDBJSON) and MongoDB (slayersDBMongo). Version 1.5.11 supports CRUD operations, nested key access, array manipulation, and table partitioning. It is designed for small-to-medium projects where simplicity is prioritized over scalability, with automatic save cooldowns to prevent corruption. Unlike heavier ORMs, it provides a minimal API with no complex schemas.

npm install slayer.db
INSTALL
IMPORT
SIG · SLAYER.DB
S
slayer.db
databasejavascriptv1.5.11
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

slayersDBMongo
✓ import { slayersDBMongo } from 'slayer.db'
✗ const slayersDBMongo = require('slayer.db').slayersDBMongo
Named export; CommonJS require works with destructuring.
slayersDBJSON
✓ import { slayersDBJSON } from 'slayer.db'
✗ import SlayersDBJSON from 'slayer.db'
Not a default export; must use named import.
default import (entire module)
✓ import * as slayer from 'slayer.db'
✗ import slayer from 'slayer.db'
No default export; use namespace import.

Demonstrates basic CRUD operations with slayersDBJSON: set, get, has, delete, save, and clear.

import { slayersDBJSON } from 'slayer.db'; const db = new slayersDBJSON({ name: 'test' }); db.set('user.name', 'Alice'); db.set('user.age', 30); console.log(db.get('user.name')); // 'Alice' console.log(db.has('user.age')); // true db.delete('user.age'); console.log(db.has('user.age')); // false db.save(); db.clear();
Debug
Known issues
gotchaSaving too frequently can corrupt JSON data. Built-in save cooldown may not prevent all corruption.
fix
Avoid calling save() in rapid loops; rely on internal cooldown or batch updates.
affects: >=1.0.0
gotchaThe slayersDBMongo class requires a running MongoDB instance. No built-in connection pooling or retry logic.
fix
Ensure MongoDB is available and provide correct connection options.
affects: >=1.0.0
gotchafindOneAndUpdate default upsert: true may create documents unintentionally.
fix
Set option { upsert: false } if you do not want automatic document creation.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'slayer.db'
Package not installed
fix
Run: npm install slayer.db
slayersDBMongo is not a constructor
Incorrect import (default instead of named)
fix
Use import { slayersDBMongo } from 'slayer.db'
TypeError: db.save is not a function
Using slayersDBMongo which has no save method (automatic)
fix
Use slayersDBJSON if you need manual save().
Upgrade
Version history
1.5.11latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
Resources
slayer.db — npm install slayer.db · libregistry