0

how can make a query with or

Example:

select * from people where eyes ="Blue" or eyes ="Green"

I use Firestore and can make when "whereEqualTo" but I need that.

My code in Android now is:

db.collection("people")
  .whereEqualTo("eyes","Blue");
Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • Sorry I forgot that use two fields "eyes" and "hair", in firebaseFirestore has whereIn but is not possible have multiple whereIn – Nestor Lopez Dec 16 '19 at 16:09
  • The accepted answer of the duplicate is out of date, but look at this specific answer, which is up to date. You want to use an 'in' query: https://stackoverflow.com/a/59216840 – Doug Stevenson Dec 16 '19 at 16:37

1 Answers1

1

If the Firestore Query documentation found here we have a section on limitations. There is an explicit coverage of OR.

It reads:

Cloud Firestore provides limited support for logical OR queries. The in and array-contains-any operators support a logical OR of up to 10 equality (==) or array-contains conditions on a single field. For other cases, create a separate query for each OR condition and merge the query results in your app.

Kolban
  • 13,794
  • 3
  • 38
  • 60