Registry / database / redis-om-type

redis-om-type

JSON →
library1.0.3jsnpmunverified

TypeScript-based Node.js library (v1.0.3) for Redis object mapping, schemas, repositories, and fluent search over JSON and hashes. Supports RediSearch and RedisJSON modules. Provides strong typing, fluent search API with chaining, pagination, full-text search, and spatial queries. Requires Node >= 14 and a Redis instance with the RediSearch and RedisJSON modules. Follows the same model as Redis OM for Node.js with TypeScript declarations. Actively maintained by Redis.

npm install redis-om-type
INSTALL
IMPORT
SIG · REDIS-OM-TYPE
R
redis-om-type
databasejavascriptv1.0.3
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.

Schema
import { Schema } from 'redis-om-type'
const { Schema } = require('redis-om-type')
ESM only; use require with .default in CJS or use dynamic import.
Repository
import { Repository } from 'redis-om-type'
import { Repository } from 'redis-om'
The package is redis-om-type, not redis-om (upstream).
Client
import { Client } from 'redis-om-type'
const client = new Redis();
Use the Client class from redis-om-type to wrap node-redis client.

Connects to Redis, defines a schema, saves an entity, and performs a fluent search.

import { Client, Entity, Schema, Repository } from 'redis-om-type'; // Create a Redis client const client = new Client(); await client.open(process.env.REDIS_URL ?? 'redis://localhost:6379'); // Define a schema const albumSchema = new Schema('album', { artist: { type: 'string' }, title: { type: 'text' }, year: { type: 'number' }, }); // Create repository const repository = new Repository(albumSchema, client); // Create an entity const album = repository.createEntity(); album.artist = 'Mushroomhead'; album.title = 'The Righteous & The Butterfly'; album.year = 2014; // Save entity const id = await repository.save(album); console.log('Saved entity with ID:', id); // Search const albums = await repository.search() .where('artist').equals('Mushroomhead') .return.all(); console.log('Found:', albums); await client.close();
Debug
Known issues
gotchaSchema definitions use type 'text' for full-text search and 'string' for exact match; mixing them can cause unexpected query results.
fix
Use 'text' for fields you need to search with .matches() and 'string' for fields you compare with .equals().
affects: >=0.0.0
deprecatedVersion 0.4 introduced breaking changes relative to 0.3.x. The API changed significantly (e.g., repository API).
fix
Upgrade to 0.4+ and follow the new API as documented in the README.
affects: <0.4.0
gotchaThe package is not the official Redis OM Node.js package (redis-om); it is a TypeScript-focused fork. Some examples from official docs may not apply.
fix
Ensure you are using redis-om-type and check its specific documentation.
affects: >=0.0.0
gotchaRequires Redis with RediSearch and RedisJSON modules. If modules are not loaded, search operations will fail.
fix
Enable the modules in your Redis config or use Redis Stack.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'search')
Repository not properly initialized or client not connected.
fix
Ensure you call repository = new Repository(schema, client) after client.open().
Error: Module not found: redis-om-type
Package not installed or wrong import path.
fix
Run 'npm install redis-om-type' and import using 'import { Schema } from 'redis-om-type''.
ReplyError: ERR unknown command 'FT.SEARCH'
Redis instance missing RediSearch module.
fix
Use Redis Stack or load the RediSearch module (e.g., redis-server --loadmodule /path/to/redisearch.so).
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies
redisoptionalRedis client for Node.js (node-redis)
@redis/clientoptionalNode Redis client library
Agent activity
10 hits · last 30 days
node
8
Meta
1
Resources
redis-om-type — npm install redis-om-type · libregistry