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

247
Vistas
Firebase: Getting all child elements that match value

I am trying to develop a system such that users are assigned tickets, and I get all tickets that are assigned for such user. 1 2

So, a user may be assigned 5 different tickets on 3 different projects. I am trying to fetch all tickets where the field of "assignee" equals [Name of user]. The screenshots I showed are the projectTickets for just one project. I need a way to fetch what I requested, and above it, put a for loop to go through every project. In every project name (d0c), there is a collection titled "projectTickets".

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

0

To get all projectTickets across all projects where 'assignee' = 'aa', use this:

db.collectionGroup("projectTickets").where("assignee", "==", "aa")
    .get()
    .then(function(querySnapshot) {
        // below is your loop
        querySnapshot.forEach(function(doc) {
            console.log(doc.id, " => ", doc.data());
        });
    })
    .catch(function(error) {
        console.log("Error getting documents: ", error);
    });

This will require indexes.

For user named 'aa', the above function should get all tickets on all projects.

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