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

312
Visualizações
How to query the array from the firestore using javascript?

So, I have this firestore that looks like the picture below. How can I query the arrays that I highlighted only to javascript format?

The array that I want is the highlighted one

How the Getting started with firestore does is by using [array-contains](https://firebase.google.com/docs/firestore/query-data/queries#:~:text=const%20q%20%3D%20query(citiesRef%2C%20where(%22regions,array_contains_filter.js) which looks like this as their example:

const q = query(citiesRef, where("regions", "array-contains", "west_coast"));

but what I see is that it only displays the word 'west_coast', what I want is that it will display any information in the field called 'amount' and 'title' as the picture above

about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

I'm afraid you can't. You need to retrieve the whole products array and filter locally.

Which leads to how your data is structured in Firestore. If that's the query you need, your data must have probably been structured differently.

For example:

  • products could be a subcollection of ordered
  • or, ordered documents may store the data you need to query in a separate, simplified array (like titles: [...], amounts: [...], but that won't help for sorting or ranges in numbers anyway).

Take a look at: https://firebase.google.com/docs/firestore/manage-data/structure-data for examples and use cases like this.

about 4 years ago · Santiago Gelvez 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