Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

310
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!