Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

33
Visualizações
ioredis - I can't filter data

First, I created a form. Every time users type an entry, it shouldn't be overwritten. so it needs to be added as an extra, I found the append command in redis and applied it. But now I don't know how to filter and fetch the data.

Append command, here I am making the data JSON

const newEntry = {
      owner_id,
      message,
      created_at: Date.now(),
      score: 1,
      ip: 'NA',
    }
await redis.append('features', JSON.stringify(newEntry))

JSON example, I need to filter with owner_id:

{"owner_id":30902468,"message":"test","created_at":1643755923014,"score":1,"ip":"NA"}

Redis docs here

ioredis

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The APPEND works on strings, it's not exactly what you are looking for...

You can use lists and create a list for each user:

const newEntry = {
  owner_id,
  message,
  created_at: Date.now(),
  score: 1,
  ip: 'NA'
};

await redis.rpush(`features:${owner_id}`, JSON.stringify(newEntry));

await redis.lrange(`features:${owner_id}`, 0, -1);

In case you need to run more complicated queries, you should consider RediSearch + RedisJSON

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda