1

I want to query my Firestore data depending on two where clauses.

Firstly the spaceId == someString and secondly the field ìsDeleted == false.

I could already find a solution with one where clause. However, I could not find any tutorials or documentation on how to query with multiple where clauses, especially for Firebase version 7.24.0.

Anyone an idea how to solve this?

Here is the code:

   this.activities = this.angularFirestore
      .collection("accounts")
      .doc(this.userId)
      .collection("activities", (ref) => 
        ref.where("spaceId", "==", this.spaceId)
      )
      .valueChanges();

1 Answer 1

2

You can just chain where calls, so:

ref.where("spaceId", "==", this.spaceId)
   .where("isDeleted", "==", false)
Sign up to request clarification or add additional context in comments.

1 Comment

That worked. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.