Last active
November 9, 2021 21:49
-
-
Save guyroyse/69bfa2571f32e289414478f46643638b to your computer and use it in GitHub Desktop.
Redis OM Quick Sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Album extends Entity {} | |
let schema = new Schema(Album, { | |
artist: { type: 'string' }, | |
title: { type: 'string', textSearch: true }, | |
year: { type: 'number' } | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let album = repository.createEntity() | |
album.artist = "Mushroomhead" | |
album.title = "The Righteous & The Butterfly" | |
album.year = 2014 | |
await repository.save(album) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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