{"id":42170,"library":"typescript-nedb-orm","title":"TypeScript NEDB ORM","description":"typescript-nedb-orm v1.7.0 is a lightweight ORM/ODM for @seald-io/nedb, a portable, file-based database for Node.js. Written entirely in TypeScript, it provides a decorator-free class-based approach to define models that extend a generic ORM class. Key features include automatic ID generation (via IID interface), CRUD operations (save, find, update, delete, remove, findOne, findById, count), and static methods for queries. Released under MIT, it targets Node.js environments. Maintained by a single developer, it is a simple alternative to heavier ORMs like Sequelize or Mongoose, leveraging NEDB's embedded nature but without support for relationships or migrations.","status":"active","version":"1.7.0","language":"javascript","source_language":"en","source_url":"https://github.com/levg34/typescript-nedb-orm","tags":["javascript","nedb","ORM","typescript","ODM"],"install":[{"cmd":"npm install typescript-nedb-orm","lang":"bash","label":"npm"},{"cmd":"yarn add typescript-nedb-orm","lang":"bash","label":"yarn"},{"cmd":"pnpm add typescript-nedb-orm","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime dependency; provides the underlying NeDB database engine.","package":"@seald-io/nedb","optional":false}],"imports":[{"note":"ESM import is the standard. CommonJS require works but is not typical.","wrong":"const ORM = require('typescript-nedb-orm').ORM","symbol":"ORM","correct":"import { ORM } from 'typescript-nedb-orm'"},{"note":"IID is an interface used for extending model interfaces. Import alongside ORM.","wrong":"const { IID } = require('typescript-nedb-orm')","symbol":"IID","correct":"import { IID } from 'typescript-nedb-orm'"},{"note":"There is no default export; the above will result in undefined. Always use named imports.","wrong":"import * as typescriptNedbOrm from 'typescript-nedb-orm'","symbol":"default","correct":"import typescriptNedbOrm from 'typescript-nedb-orm'"}],"quickstart":{"code":"import { IID, ORM } from 'typescript-nedb-orm'\n\ninterface IPerson extends IID {\n    name: string\n    email: string\n}\n\nclass Person extends ORM<IPerson> implements IPerson {\n    name: string\n    email: string\n    constructor(person: IPerson) {\n        super(person)\n        this.name = person.name\n        this.email = person.email\n    }\n}\n\nasync function run() {\n    const person = new Person({ name: 'Luc', email: 'luc@luc.fr' })\n    const saved: IPerson = await person.save()\n    const found: IPerson | null = await Person.findOne<IPerson>({ name: 'Luc' })\n    console.log(found?.email) // luc@luc.fr\n    await person.delete()\n}\nrun().catch(console.error)","lang":"typescript","description":"Defines a Person model extending ORM, saves, queries, and deletes documents."},"warnings":[{"fix":"Ensure constructor copies all fields from the argument to this before calling super, or delegate to super(person) and assign after.","message":"Model classes must implement the field interface and call super() with the same data; failing to do so results in undefined fields.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always await static method calls, or use .then().","message":"Static methods like find, findOne, findById, update, remove, count are asynchronous and must be awaited.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Include id: string in your interface or use a default UUID-like string.","message":"The ORM class constructor expects an object with IID (id field); omitting id will cause type errors.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Refer to @seald-io/nedb documentation for supported query operators.","message":"The package depends on @seald-io/nedb, which is a fork of the original NeDB. Some query operators may differ.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'/nedb':17 'altern':89 'approach':39 'automat':52 'base':22,38 'class':37,48 'class-bas':36 'count':67 'crud':58 'databas':23 'decor':34 'decorator-fre':33 'defin':41 'delet':63 'develop':84 'embed':100 'entir':27 'environ':79 'extend':44 'featur':50 'file':21 'file-bas':20 'find':61 'findbyid':66 'findon':65 'free':35 'generat':54 'generic':46 'heavier':91 'id':53 'iid':56 'includ':51 'interfac':57 'io':16 'javascript':109 'key':49 'leverag':97 'lightweight':11 'like':93 'maintain':80 'method':70 'migrat':108 'mit':75 'model':42 'mongoos':96 'natur':101 'nedb':2,6,98,110 'node.js':25,78 'odm':113 'oper':59 'orm':3,7,47,92,111 'orm/odm':12 'portabl':19 'provid':31 'queri':72 'relationship':106 'releas':73 'remov':64 'save':60 'seald':15 'seald-io':14 'sequel':94 'simpl':88 'singl':83 'static':69 'support':104 'target':77 'typescript':1,5,29,112 'typescript-nedb-orm':4 'updat':62 'v1.7.0':8 'via':55 'without':103 'written':26","created_at":"2026-06-04T18:55:57.456832+00:00","updated_at":"2026-06-04T18:55:57.456832+00:00","problems":[{"fix":"Ensure the class extends ORM<IPerson> and that save() is called inside an async function with await.","cause":"Forgetting to extend ORM<IPerson> or calling save on instance without await inside async context.","error":"Property 'save' does not exist on type 'Person'."},{"fix":"Add import { IID, ORM } from 'typescript-nedb-orm' at the top of the file.","cause":"Missing import of IID from typescript-nedb-orm.","error":"Cannot find name 'IID'"},{"fix":"Ensure methods are called on instances of Person, not on the class itself (except static methods).","cause":"Calling a method like save() directly without an instance or using class instead of instance.","error":"The 'this' context of type 'Person' is not assignable to method's 'this' of type 'ORM<IPerson>'"}],"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":"https://github.com/levg34/typescript-nedb-orm#readme","github":"https://github.com/levg34/typescript-nedb-orm","docs":null,"changelog":null,"pypi":null,"npm":"typescript-nedb-orm","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-04","next_check":"2026-09-02","install_tag":null}}