{"id":28186,"library":"slayer.db","title":"Slayer.DB","description":"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.","status":"active","version":"1.5.11","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","db","database","data"],"install":[{"cmd":"npm install slayer.db","lang":"bash","label":"npm"},{"cmd":"yarn add slayer.db","lang":"bash","label":"yarn"},{"cmd":"pnpm add slayer.db","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Named export; CommonJS require works with destructuring.","wrong":"const slayersDBMongo = require('slayer.db').slayersDBMongo","symbol":"slayersDBMongo","correct":"import { slayersDBMongo } from 'slayer.db'"},{"note":"Not a default export; must use named import.","wrong":"import SlayersDBJSON from 'slayer.db'","symbol":"slayersDBJSON","correct":"import { slayersDBJSON } from 'slayer.db'"},{"note":"No default export; use namespace import.","wrong":"import slayer from 'slayer.db'","symbol":"default import (entire module)","correct":"import * as slayer from 'slayer.db'"}],"quickstart":{"code":"import { slayersDBJSON } from 'slayer.db';\n\nconst db = new slayersDBJSON({ name: 'test' });\ndb.set('user.name', 'Alice');\ndb.set('user.age', 30);\nconsole.log(db.get('user.name')); // 'Alice'\nconsole.log(db.has('user.age')); // true\ndb.delete('user.age');\nconsole.log(db.has('user.age')); // false\ndb.save();\ndb.clear();","lang":"typescript","description":"Demonstrates basic CRUD operations with slayersDBJSON: set, get, has, delete, save, and clear."},"warnings":[{"fix":"Avoid calling save() in rapid loops; rely on internal cooldown or batch updates.","message":"Saving too frequently can corrupt JSON data. Built-in save cooldown may not prevent all corruption.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure MongoDB is available and provide correct connection options.","message":"The slayersDBMongo class requires a running MongoDB instance. No built-in connection pooling or retry logic.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set option { upsert: false } if you do not want automatic document creation.","message":"findOneAndUpdate default upsert: true may create documents unintentionally.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Run: npm install slayer.db","cause":"Package not installed","error":"Cannot find module 'slayer.db'"},{"fix":"Use import { slayersDBMongo } from 'slayer.db'","cause":"Incorrect import (default instead of named)","error":"slayersDBMongo is not a constructor"},{"fix":"Use slayersDBJSON if you need manual save().","cause":"Using slayersDBMongo which has no save method (automatic)","error":"TypeError: db.save is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}