Registry / database / query-orm

query-orm

JSON →
library1.2.0jsnpmunverified

query-orm is a Loopback-like ORM for Node.js that works with any framework, currently at version 1.2.0. It provides a declarative model definition with filters, relations, and operational hooks, and supports Elasticsearch via the query-orm-connector-elastic connector. Unlike traditional ORMs like Sequelize or Mongoose, it is designed to be framework-agnostic and uses JSON configuration for models and datasources. It is not actively maintained (last release 5+ years ago) and has limited documentation.

npm install query-orm
INSTALL
IMPORT
SIG · QUERY-ORM
Q
query-orm
databasejavascriptv1.2.0
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.

QueryORM
const QueryORM = require('query-orm');
import QueryORM from 'query-orm';
query-orm uses CommonJS and does not provide ESM exports. Use require.
app.models
const app = new QueryORM({...}); app.models.User.create(data);
app.models.user.find(...) // incorrect case
Model names are case-sensitive and match the model-config.json names.
Model definitions
Model definitions are in JSON files, not code
class User extends Model {}
QueryORM uses JSON model configuration, not class-based definitions like LoopBack 4.

Initializes QueryORM with model and datasource config, creates a User, and queries by username.

const QueryORM = require('query-orm'); const path = require('path'); const app = new QueryORM({ appRoot: __dirname, modelConfig: './model-config.json', dataSources: './datasource.json' }); app.on('model-init', (data) => { console.log('Models initialized:', data); }); async function main() { const user = await app.models.User.create({ firstname: 'Bharath', lastname: 'Reddy', username: 'bharathreddy', password: 'Test@1234' }); console.log('Created user:', user); const found = await app.models.User.find({ where: { username: 'bharathreddy' } }); console.log('Found:', found); } main().catch(err => console.error(err));
Debug
Known issues
gotchaQueryORM is not actively maintained and relies on a deprecated Elasticsearch connector.
fix
Consider using a more modern ORM like Sequelize, TypeORM, or Prisma.
affects: >=1.0.0
breakingThe datasource configuration expects 'configuration' object with 'nodes' array, not 'host' string.
fix
Use the format shown in datasource.json in the documentation.
affects: >=1.0.0
gotchaModel IDs are defined in the model JSON under 'id' property, not automatically generated unless 'generated: true' is set.
fix
Ensure 'id' field in model-config.json has 'property' and 'generated'.
affects: >=1.0.0
deprecatedThe package has not been updated since 2019 and uses older Elasticsearch client.
fix
Migrate to a supported ORM or use a custom connector.
affects: >=1.0.0
gotchaModel property types are defined as strings in JSON schema but may not be validated strictly.
fix
Use explicit type checks in application code.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'query-orm-connector-elastic'
Missing required connector package.
fix
npm install query-orm-connector-elastic
TypeError: app.models.User.create is not a function
Model not initialized due to incorrect model-config.json path or format.
fix
Ensure model-config.json contains valid model definitions and 'directory' pointing to model JSON files.
Error: connect ECONNREFUSED localhost:9200
Elasticsearch not running or incorrect host/port in datasource.json.
fix
Start Elasticsearch or update 'nodes' array in datasource.json
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies
query-orm-connector-elasticoptionalRequired for Elasticsearch connectivity
Agent activity
6 hits · last 30 days
node
4
Meta
1
Resources
query-orm — npm install query-orm · libregistry