Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

284
Visualizações
How to use 'where' with AngularFire 7 new api?

I upgraded AngularFire to 7, and have a problem with using .where with collectionReference. So simply.. how to use it properly?

I tried to use 'collection' from '@angular/fire/firestore' like:

const ref = collection(this.firestore, 'collectionName');

but the ref has not 'where' or something.

I know that '@angular/fire/firestore' has also 'query' and 'where', but I don't know how to use it.

How to find documents in the collection using 'where' with a new API?

about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

AngularFire 7.0 is based on the new tree-shakable Firebase JS SDK v9, so you should do as follows (untested):

const ref = collection(this.firestore, 'collectionName');
const q = query(ref, where("...", "==", "..."));

See the doc here (tab "Web version 9").

about 4 years ago · Juan Pablo Isaza Relatório

0

AngularFire has the Firebase JS SKD v9 syntax, using their own objects:

import {collection, collectionData, Firestore, query, where} from '@angular/fire/firestore';

export class FooClass {

  constructor(private firestore: Firestore){
    const ref = collection(firestore, 'collectionName');
    const q = query(ref, where('ids', 'array-contains', id));
    const res$ = collectionData(q);
  }

about 4 years ago · Juan Pablo Isaza Relatório

0

I managed to figure this one out...

for single where statement use

const refq = query(ref,where('dir','==','T'))

for multiple where statements use

const wa:QueryConstraint[] = [where('dir','==','T'),where('day','==',23)]

const refq = query(ref,...wa)

to get the results use

collectionData(refq).subscribe()
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda