redis / redis-om-node

Object mapping, and more, for Redis and Node.js. Written in TypeScript.
MIT License
1.18k stars 80 forks source link

Docs do not clarify if createIndex() builds indexes for all props or selected (relevant for costs on pay/request hosters) #181

Closed 205g0 closed 1 year ago

205g0 commented 1 year ago

Example:

user = {
  id: string, // which is Redis' record key
  firstName: string,
  lastName: string,
  email: stinrg,
  username: string,
}

For which props are indexes build?

  1. All props? I guess not, would be to expensive
  2. Just the id/key? Shouldn't because Redis does this already itself
guyroyse commented 1 year ago

Redis OM 0.3.x will index all the fields that are not marked a indexed=false. This is true for Redis 0.4.1@beta as well, however, you do not have to add a field to the schema at all in order to read and write it with the newer version.