I need equivalent query of
SELECT PlayerName FROM GameScores WHERE Department = \'HR\' OR Department = \'IT\' OR Department = \'Marketing\'
The only way to filter a property on multiple values in Firebase is if those values are in a range. For example, you could get all items matching your values with:
ref.child("GameScores")
.orderByChild("Department")
.startAt("HR")
.endAt("Marketing")
The problem with this is that it also matches scores from other departments whose name is between HR
and Marketing
, such as
There is no way in either the Firebase Realtime Database or Cloud Firestore to pass multiple separate values into a query. You will have to execute a separate query for each value and merge them client-side.
Also see: