Ranjit
Ranjit

Reputation: 5150

IllegalArgumentException: Invalid Query. You cannot use more than one 'in' filter

Currently, I am trying to execute 2 collections using whereIn like below.

db.collection("ABC").whereEqualTo("orgType", "Test")
                    .whereIn("dist", selectedAreaNames)
                    .whereIn("price", selectedPriceRanges)
                    .get().addOnSuccessListener(queryDocumentSnapshots -> {
                     .................
                     .................

Where its working perfectly when I execute a single whereIn(i.e selectedAreaNames or selectedPriceRanges at a time) but for both it's throwing IllegalArgumentException: Invalid Query. You cannot use more than one 'in' filter exception.

If firestore is allowing one whereIn at a time for now then is there any alternative solution for the above problem? Just like any other queries or claues etc which will help me to execute both at a time?

Upvotes: 1

Views: 798

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317712

Your alternative is to perform a single "in" query, then filter the remaining results in the client app. Firestore won't do it for you - it's a hard limit that can't be worked around.

Upvotes: 1

Related Questions