Registry / database / orm-model

orm-model

JSON →
library0.1.1jsnpmunverified

Unified MVC-style model structure for Node.js projects using mongoose and/or sequelize ORMs. Current version 0.1.1, last updated in 2015. Allows defining models in separate files with connectors, attributes, and extensions. Differentiator: provides a structured way to organize models when using multiple databases or ORMs. Release cadence: no recent releases.

npm install orm-model
INSTALL
IMPORT
SIG · ORM-MODEL
O
orm-model
databasejavascriptv0.1.1
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.

default
✓ import orm from 'orm-model'
✗ const orm = require('orm-model')
ESM vs CJS: package does not ship ESM; default import only works with bundlers. Use require() in Node <v14.
orm.model()
✓ import orm from 'orm-model'; orm.model('Bird')
Access models after connect().
orm.connection()
✓ import orm from 'orm-model'; orm.connection('seq-db')
Returns the ORM connection instance.

Shows setup of connectors, model loading, and basic model usage.

import orm from 'orm-model'; // configure connectors at config/connectors.js orm.connect({ connectorsPath: 'config/connectors.js', modelsPath: 'app/models' }); // after connection, access model const Bird = orm.model('bird'); Bird.create({ name: 'Fluppy' }, (err, data) => { if (err) console.error(err); else console.log('Bird created:', data); });
Debug
Known issues
deprecatedPackage last updated in 2015, no maintenance for over 8 years.
fix
Consider alternatives like sequelize-cli or mongoose schemas directly.
affects: 0.x
gotchaOnly supports mongoose and sequelize; other ORMs are not configurable.
fix
Verify your ORM is supported before adoption.
affects: >=0.1.0
breakingExpects config files at hardcoded paths (config/connectors.js, app/models) unless overridden.
fix
Always specify connectorsPath and modelsPath in orm.connect().
affects: >=0.1.0
gotchaNo TypeScript definitions or type checking; runtime errors for missing models.
fix
Wrap model access in try/catch or check existence with orm.models().
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'orm-model'
Package not installed or missing from node_modules.
fix
npm install orm-model --save
TypeError: orm.connect is not a function
Incorrect import (ESM vs CJS) or wrong module scope.
fix
Use correct import: const orm = require('orm-model'); or import orm from 'orm-model'; if using ESM bundler.
Error: No connector defined for model 'Bird'
Connector name in model definition does not match connectors configuration.
fix
Check connectorsPath file and ensure connector key matches 'connector' field in model file.
Upgrade
Version history
0.1.1latest on npm
Audit
Dependencies
mongooseoptionalORM adapter for MongoDB
sequelizeoptionalORM adapter for SQL databases
Agent activity
7 hits · last 30 days
node
6
Resources
orm-model — npm install orm-model · libregistry