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

203
Vistas
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 Respuestas
Responde la pregunta

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