0

I'm using firebase and angular11. I try to get all those documents where sme_id is null or match with the id which we passed inside the query.

I have tried something like this but it gives me an empty array.

  get_active_chat(id) {
    return this.firebase_store
      .collection('chat', (ref) => ref.where('sme_id', 'in', [null, id]))
      .snapshotChanges();
  }


  get_all_student_chat() {
    this.spinner = true;
    this.chat_service.get_active_chat(localStorage.getItem('uid')).subscribe(
      (res) => {
        const data = FormativeData.formative_snapshot_data(res);
        console.log(data);
        this.spinner = false;
      },
      (error) => console.log(error)
    );
  }

How can I perform OR query?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Mohd Sabban
  • 182
  • 1
  • 12
  • Can you edit your question to show a screenshot of a document that you'd expect the query to return? – Frank van Puffelen May 09 '21 at 15:10
  • Does this answer your question? [How to perform compound queries with logical OR in Cloud Firestore?](https://stackoverflow.com/questions/46632042/how-to-perform-compound-queries-with-logical-or-in-cloud-firestore) – Farid Shumbar May 10 '21 at 14:57

0 Answers0