Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

95
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda