Redis OM uses Entities (JavaScript objects) and Schemas to map data to Redis.
A Schema defines the fields of an entity, their types, and how they are stored. The first argument to the Schema constructor is the Schema name, which acts as the key name prefix for all entities of that type in Redis.
Supported Field Types
string: Exact match only. Best for discrete data like IDs or status.text: Enables full-text search (supports stemming and stop words). Best for human-readable content.number: Numeric values.boolean: Boolean values.string[]: An array of strings.number[]: An array of numbers (Note: only supported with JSON data structure).date: A JavaScript Date, an ISO 8601 string, or a UNIX epoch timestamp in seconds.point: A geographic point expressed as { longitude: number, latitude: number }.
import { Schema } from 'redis-om'
const albumSchema = new Schema('album', {
artist: { type: 'string' },
title: { type: 'text' },
year: { type: 'number' },
genres: { type: 'string[]' },
songDurations: { type: 'number[]' },
outOfPublication: { type: 'boolean' }
})