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

144
Visualizações
Firestore special query (with arrays)

Hey guys I'm having a problem with one of my queries!

I have some "store" docs, and in those docs I got an array of "products".

Each product has a "expirationDate". I would like to know how could I get the "store"'s where there is at least 1 expired "product". Something like:

const currentDate = new Date();
  db.collection("stores")
  .where("for each (product) {return product.expirationDate}", "<", currentDate.getTime())
  .get().then((querySnapshot) => {
    // Get all stores with at least 1 expired product
  });
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Firestore can only order/filter on values that are stored in the documents that it returns. If you want to filter on the number of expired products, you will have to store that value in a field in the document - and keep it up to date (for example in a daily process).

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