{"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,"search_vec":"'1.5.11':26 'access':32 'api':67 'array':33 'automat':54 'backend':16 'base':20 'complex':70 'cooldown':56 'corrupt':59 'crud':28 'data':75 'databas':10,74 'db':73 'design':40 'easi':7 'easy-to-us':6 'file':19 'heavier':61 'javascript':72 'json':18 'json-file-bas':17 'key':31 'lightweight':5 'manipul':34 'medium':45 'minim':66 'modul':11 'mongodb':23 'nest':30 'node.js':13 'offer':14 'oper':29 'orm':62 'partit':37 'prevent':58 'priorit':50 'project':46 'provid':64 'save':55 'scalabl':52 'schema':71 'simplic':48 'slayer.db':1,2 'slayersdbjson':21 'slayersdbmongo':24 'small':43 'small-to-medium':42 'support':27 'tabl':36 'two':15 'unlik':60 'use':9 'version':25","created_at":"2026-05-09T05:54:10.785122+00:00","updated_at":"2026-05-09T05:54:10.785122+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/slayer.db","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-05-09","next_check":"2026-08-07","install_tag":null}}