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

202
Visualizações
Function Query.where() called with invalid data

I want to set two conditions for displaying data. But such error occurs in the browser console.

Function Query.where() called with invalid data. Unsupported field value: undefined

ts:

How to fix it?

  this.itemsCollection = this.afs.collection<Message>('messages', ref => {
    let query: firebase.default.firestore.CollectionReference | firebase.default.firestore.Query = ref;
    query = query.where('receiverId', '==', this.receiverId);
    query = query.where('senderId', '==', this._cs.senderId);
    return query;
  });
  this.items = this.itemsCollection.valueChanges();
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Your code looks fine but as the error message text says one of your variables this.receiverId or this._cs.senderId has the value undefined and that causes the error. Just make sure not to have undefined there by putting some kind of fallback values.

 this.itemsCollection = this.afs.collection<Message>('messages', ref => {
    let query: firebase.default.firestore.CollectionReference | firebase.default.firestore.Query = ref;
    query = query.where('receiverId', '==', this.receiverId || '');
    query = query.where('senderId', '==', this._cs.senderId || '');
    return query;
  });
  this.items = this.itemsCollection.valueChanges();
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