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

263
Visualizações
How to fetch data from multidimensional array in firebase

Hello my Database looks like this:

Database screenshot

"delivery_pincode": [
      {
        "item_id": "106380730",
        "item_text": "560074"
      },
      {
        "item_id": "119323097",
        "item_text": "562164"
      },
      {
        "item_id": "126726811",
        "item_text": "560050"
      },
      {
        "item_id": "129564907",
        "item_text": "560115"
      }
]

Provided in the image and I want to fetch data in which I have added code

.where("delivery_pincode","array-contains-any" , pincode)

where pincode is "560074" so the result is giving empty array . I have also tried with code

.where("delivery_pincode","array-contains-any" , [item_text: "560074"])

which is again giving empty array . any solution to fetch data based on item_text's pincode ?

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

0

The array-contains and array-contains-any operators check whether the value you passed matches a complete item in the array; they can't be used to match a subset of an item.

So with your current data structure, you will have to use this query:

.where("delivery_pincode","array-contains", {"item_id": "106380730",item_text: "560074"})

If you don't know all properties of the item, the common workaround to allow your use-case is to add an additional array field with just the values you do know, and then query on that.

So for you that would be a field delivery_pincode_item_texts:

delivery_pincode_item_texts: [
  "560074",
  "562164",
  "560050",
  "560115"
]

You can then query that with:

.where("delivery_pincode_item_texts","array-contains-any", ["560074"])

or

.where("delivery_pincode_item_texts","array-contains", "560074")
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