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

218
Vistas
Firestore query by timestamp and another field

Using firestore v9 I faced up with 1 problem. I have a list of documents, and here 1 of them:

end_hour: 21 master: "WIZ1d74QmvMNDEQKulJyiQNCnad2" start_hour: 13 working_day: January 11, 2022 at 9:00:00 PM UTC+3

And I try to receive all documents, where master is equal as passed ID and working_day more than passed Date.

const response = await db.collection('schedule')
        .where('working_day', '>=', new Date())
        .where('master', '==', masterId)
        .get();

This request doesn't return any data at all, but when I do request using only first

const response = await db.collection('schedule')
        .where('working_day', '>=', new Date()).get()

or when I do query by second field

    const response = await db.collection('schedule')
        .where('master', '==', masterId)
        .get();

Both of them works alone, but not in a pair and I just don't know what is the problem

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

As mentioned by Caio, you'll need a composite index. From https://cloud.google.com/firestore/docs/query-data/queries#compound_queries, it says "You can chain multiple equality operators (== or array-contains) methods to create more specific queries (logical AND). However, you must create a composite index to combine equality operators with the inequality operators, <, <=, >, and !=."

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