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

108
Views
Firebase get document collection based on specific field using angular

firebase image

I want to get collection data based on UserId field .

getData(){
   const data$ = this.fbs.collection(this.trackerData,ref=> ref.where('UserId','==',"WrKDk0XSNjU20FI0EVRvADzvNHz1")).snapshotChanges().subscribe(res=>{
     console.log(res);
   });
}

if i get data like this i am getting response as :-

response

but i need response data like :-

actual response

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

0

You need to transform your stream to get what you want:

getData(userId: string){
    return this.fbs.collection(
        this.trackerData,
        ref=> ref.where('UserId','==',userId)
    ).snapshotChanges().pipe(
        map(action => {
            const data = action.payload.data();
            const id = action.payload.id;
            return { id, ...data };
        })
    );
}

getData("WrKDk0XSNjU20FI0EVRvADzvNHz1").subscribe(res=> console.log(res));
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!