Registry / database / hw-redis-ohm

hw-redis-ohm

JSON →
library0.6.5jsnpmunverified

hw-redis-ohm is a Node.js module for mapping JavaScript objects to Redis hashes (Object-Hash Mapping), providing a simple ORM-like interface for Redis. Version 0.6.5 is the latest stable release, with sporadic updates. It supports basic CRUD operations, indexing, and validation. Unlike ioredis or node_redis, it abstracts hash storage directly, but is not actively maintained and has limited documentation beyond test specs. Requires Node >=6.2.2 and a running Redis instance.

npm install hw-redis-ohm
INSTALL
IMPORT
SIG · HW-REDIS-OHM
H
hw-redis-ohm
databasejavascriptv0.6.5
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 Ohm from 'hw-redis-ohm'
const Ohm = require('hw-redis-ohm').default
Package uses CommonJS default export; use default import or require directly.
Ohm
const Ohm = require('hw-redis-ohm')
import { Ohm } from 'hw-redis-ohm'
Named import is incorrect because package exports a single default class.
Model
const { Model } = require('hw-redis-ohm')
import Model from 'hw-redis-ohm'
Model may not be directly exported; check package structure. Typically, Ohm is the base class.

Demonstrates defining a model with Ohm.define, creating an instance, saving to Redis, and fetching by ID.

const redis = require('redis'); const client = redis.createClient({ host: process.env.REDIS_HOST || 'localhost', port: process.env.REDIS_PORT || 6379 }); const Ohm = require('hw-redis-ohm'); const User = Ohm.define('User', { name: String, email: String, age: { type: Number, default: 0 } }); async function example() { const user = new User({ name: 'Alice', email: 'alice@example.com' }); await user.save(); console.log('Saved user id:', user.id); const fetched = await User.findById(user.id); console.log('Fetched:', fetched); } example().catch(console.error);
Debug
Known issues
deprecatedPackage is in maintenance mode with no active development. Last update 2016.
fix
Consider using a more modern Redis ORM like redis-om or ioredis-based solutions.
affects: >=0.0.0
gotchaRequires a running Redis instance; no default mock or in-memory mode.
fix
Ensure Redis is accessible via REDIS_HOST and REDIS_PORT environment variables or configure manually.
affects: >=0.0.0
gotchaType definitions are not included; TypeScript users must create their own .d.ts or use any.
fix
Write custom type declarations or use `@ts-ignore`.
affects: >=0.0.0
breakingBreaking change between versions 0.5.x and 0.6.x: API changed from callbacks to promises.
fix
Update code to use async/await or .then() instead of callbacks.
affects: >=0.6.0
gotchaModel ID generation is automatic using Redis INCR; may conflict with manually set IDs.
fix
Do not set id property manually; use the auto-generated id after save.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: Ohm is not a constructor
Incorrect import style - using named import when default export is expected.
fix
Use `const Ohm = require('hw-redis-ohm')` instead of `import { Ohm } from 'hw-redis-ohm'`.
Error: Redis connection refused
Redis server is not running or unreachable at the configured host/port.
fix
Start Redis service or set correct REDIS_HOST and REDIS_PORT environment variables.
Cannot find module 'redis'
Missing peer dependency 'redis'.
fix
Run `npm install redis` in your project.
Ohm.define is not a function
Using the module incorrectly; Ohm may not have define method in older versions.
fix
Update to version 0.6.x or check the API documentation for correct usage.
Upgrade
Version history
0.6.5latest on npm
Audit
Dependencies
redisrequiredRequired for Redis client connectivity
Agent activity
6 hits · last 30 days
node
6
Resources
hw-redis-ohm — npm install hw-redis-ohm · libregistry