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

93
Views
Firestore query after adding composite index still return nothing

I have already created react app and I'm using firebase firestore. So at the start of using I didn't have any problems, until I found that I need to create a query like that:

db.collection('schedule')
            .where('working_day', '>=', new Date())
            .where('master', '==', masterId)
            .orderBy('working_day', 'desc')
            .get();

I have a collection called schedule and this schedule collection has list of documents. Each document has structure:

working_day: timestamp;
start_hour: number;
end_hour: number;
master: string;

When I called this query - I didn't see any result (request is gone, but no results at all). Someone suggest me to add composite indexing and It must solve this problem I did it using firestore indexing tab and now I have this indexing:

Collection ID   Fields indexed                          Query scope     Status
schedule    working_day Descending master Descending    Collection      Enabled

It has been successfully applied - but still my request without any result. Also I know that firestore could notice me that I need to apply this indexing and provide me the link - but I don't see this link. Where I should find this? Or maybe I do something wrong?

Break my head for the 2 days and didn't find why I have this issue

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It looks like working.day is stored in your firestore database as a timestamp but your query condition is comparing against a javascript date object which could be causing an issue. Try replacing the date object with a firebase timestamp like the code below.

db.collection('schedule')
            .where('working_day', '>=',  new firebase.firestore.Timestamp.now())
            .where('master', '==', masterId)
            .orderBy('working_day', 'desc')
            .get();



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!