Shamoon
Shamoon

Reputation: 43491

Search redis hash by value

I'm using node.js (with coffee) and here's how I'm saving to redis:

  hash = "tweet:#{twitterResult.id}"
  hashset =
    tweet_id: twitterResult.id
    screenname: twitterResult.user.screen_name
    gender: gender

  client.hmset hash, hashset, ->
    console.log "SAVED IN REDIS"

How can I retrieve all people saved that are female with a query?

Upvotes: 1

Views: 1328

Answers (1)

Itay Moav -Malimovka
Itay Moav -Malimovka

Reputation: 53597

You need to manually create an index (redis is not a relational DB, and as rule of thumb, care not of the values you enter it).
For example, create a list of all hash ids which belong to females. (gender:female list)

Upvotes: 2

Related Questions