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

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

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