Skip to content

Instantly share code, notes, and snippets.

@guyroyse
Last active November 9, 2021 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guyroyse/69bfa2571f32e289414478f46643638b to your computer and use it in GitHub Desktop.
Save guyroyse/69bfa2571f32e289414478f46643638b to your computer and use it in GitHub Desktop.
Redis OM Quick Sample
class Album extends Entity {}
let schema = new Schema(Album, {
artist: { type: 'string' },
title: { type: 'string', textSearch: true },
year: { type: 'number' }
});
let album = repository.createEntity()
album.artist = "Mushroomhead"
album.title = "The Righteous & The Butterfly"
album.year = 2014
await repository.save(album)
let albums = await repository.search()
.where('artist').equals('Mushroomhead')
.and('title').matches('butterfly')
.and('year').is.greaterThan(2000).returnAll()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment