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

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

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