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

201
Views
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 answers
Answer question

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