Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update stack-node.md #228

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/stack/clients/om-clients/stack-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@ A `text` field is a lot like a `string`. If you're just reading and writing obje

### Repository

Now we have all the pieces that we need to create a **repository**. A `Repository` is the main interface into Redis OM. It gives us the methods to read, write, and remove a specific `Entity`. Create a `Repository` in `person.js` and make sure it's exported as you'll need it when we start implementing out API:
Now we have all the pieces that we need to create a **repository**. A `Repository` is the main interface into Redis OM. It gives us the methods to read, write, and remove a specific `Entity`. Fetch a `Repository` in `person.js` using `fetchRepository` and make sure it's exported as you'll need it when we start implementing out API:

{{< highlight javascript >}}
/* use the client to create a Repository just for Persons */
export const personRepository = new Repository(personSchema, client)
export const personRepository = client.fetchRepository(personSchema)
{{< / highlight >}}

We're almost done with setting up our repository. But we still need to create an index or we won't be able to search. We do that by calling `.createIndex()`. If an index already exists and it's identical, this function won't do anything. If it's different, it'll drop it and create a new one. Add a call to `.createIndex()` to `person.js`:
Expand Down