{"id":43795,"library":"save","title":"save","description":"A simple CRUD-based persistence abstraction for storing objects to any backend data store, v2.9.0 (current stable). Released periodically, with support for in-memory, MongoDB, and custom engines via a plugin architecture. Differentiators: unified API across multiple backends, built-in event hooks for CRUD operations, and a lightweight design that decouples application logic from specific databases.","status":"active","version":"2.9.0","language":"javascript","source_language":"en","source_url":"git@github.com:serby/save","tags":["javascript"],"install":[{"cmd":"npm install save","lang":"bash","label":"npm"},{"cmd":"yarn add save","lang":"bash","label":"yarn"},{"cmd":"pnpm add save","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Recommended MongoDB engine for real-world use","package":"save-mongodb","optional":true}],"imports":[{"note":"CommonJS module; no default ESM export as of v2.9.0","wrong":"import save from 'save'","symbol":"save","correct":"const save = require('save')"},{"note":"save() is a factory function, not a constructor; no new keyword.","wrong":"const s = new save('person')","symbol":"save function","correct":"const s = save('person')"},{"note":"Set idProperty in options during initialization, not after.","wrong":"s.idProperty = '_id'","symbol":"idProperty","correct":"const s = save('person', { idProperty: '_id' })"}],"quickstart":{"code":"const save = require('save');\nconst s = save('person');\n\ns.create({ name: 'Dom' }, function(err, person) {\n  if (err) throw err;\n  console.log(person);\n});\n\ns.read(1, function(err, person) {\n  if (err) throw err;\n  console.log(person);\n});\n\ns.update({ _id: 1, name: 'Dominic' }, false, function(err, person) {\n  if (err) throw err;\n  console.log(person);\n});\n\ns.delete(1, function(err) {\n  if (err) throw err;\n  console.log('Deleted');\n});","lang":"javascript","description":"Initializes a 'save' instance for 'person' model with in-memory engine, performs CRUD operations (create, read, update, delete)."},"warnings":[{"fix":"Use const s = save('person') without new.","message":"save() is a function, not a constructor. Do not use 'new'.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Check engine documentation for supported options.","message":"Options like 'logger' are engine-specific; some engines may ignore them.","severity":"deprecated","affected_versions":">=2.5.0"},{"fix":"Use a persistent engine like save-mongodb for production.","message":"The in-memory engine is not persistent; data is lost on restart.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"For atomic deletes, use engine-specific methods.","message":"deleteMany() performs find then delete for each item; not atomic.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Use 'afterCreate', 'afterUpdate', etc. as per v2+.","message":"Event names changed between versions; 'afterCreate' not 'create' for post-create.","severity":"breaking","affected_versions":"<2.0.0"}],"env_vars":null,"search_vec":"'abstract':8 'across':39 'api':38 'applic':56 'architectur':35 'backend':14,41 'base':6 'built':43 'built-in':42 'crud':5,48 'crud-bas':4 'current':18 'custom':30 'data':15 'databas':60 'decoupl':55 'design':53 'differenti':36 'engin':31 'event':45 'hook':46 'in-memori':25 'javascript':61 'lightweight':52 'logic':57 'memori':27 'mongodb':28 'multipl':40 'object':11 'oper':49 'period':21 'persist':7 'plugin':34 'releas':20 'save':1 'simpl':3 'specif':59 'stabl':19 'store':10,16 'support':23 'unifi':37 'v2.9.0':17 'via':32","created_at":"2026-06-05T17:01:31.119455+00:00","updated_at":"2026-06-05T17:01:31.119455+00:00","problems":[{"fix":"Use const save = require('save');.","cause":"Using require incorrectly or importing ESM style","error":"TypeError: save is not a function"},{"fix":"Run npm install save.","cause":"Package not installed","error":"Error: Cannot find module 'save'"},{"fix":"Use const s = save('person') without new.","cause":"save() called with 'new' or wrong instance","error":"TypeError: s.create is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"git@github.com:serby/save","github":"git@github.com:serby/save","docs":null,"changelog":null,"pypi":null,"npm":"save","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-06-05","next_check":"2026-09-03","install_tag":null}}