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

202
Views
Angular firestore perform another query from previous query

I using @angular/fire to query data and I want to saving the firebase cost by reducing the number call of firebase query.

I have 2 function that query from the same collection. First is get all data and second is query with condition. How the second function to query data from the first function so it only call 1 time if firebase query

constructor(private _afs: AngularFirestore)

function 1 get all data from user

this._afs.collection('firebase-user-table').valueChanges().subscribe(data => {
        console.log('User data:', data);
      })

function 2 get only which user is_admin is true

this._afs.collection('firebase-user-table', (ref) => ref.where(is_admin, '==', true)).valueChanges().subscribe(data => {
        console.log('Admin data:', data);
      })
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You could do something like this using rxjs:

let allUsers$ = this._afs.collection('firebase-user-table').valueChanges();

let adminUsers$ = allUsers$.pipe(
map((users) => users.filter(user)) => user.is_admin)
)

Then subscribe to each observable as needed

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!