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

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

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 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!