2

How to combine multiple values inside one equalTo() method?

I mean that i want to return the places which is in Egypt or USA for example

So i want it this way

ref.orderByChild("country").equalTO("Egypt OR USA");

but it doesn't work like that

I want to know how to make it work inside just one query

koceeng
  • 2,169
  • 3
  • 16
  • 37
  • You could just get `ref.orderByChild("country")`, then in Java, compare to Egypt or USA. Currently, you're checking a String literal, so unless you have a country named `"Egypt OR USA"`, that won't work, no – OneCricketeer Dec 11 '16 at 15:37
  • Thanks Cricket for your answer...I really know this approach I was wondering how to do on the server side because maybe after my product release then I will have to return all the data then iterate through it to return only my client's matches...then imagine I am having 10 thousands or even more data nodes that will be returned back each time.....I think this is awful so I was wondering if they have another approach for equal to x or y in the same query – Mahmoud Amin Dec 12 '16 at 06:56
  • If you really want to place it on server side, I think the easiest and fastest way (for now) is to add parameter to your country that mention it is either `Egypt` or `USA` then filter based on that parameter. – koceeng Jan 12 '17 at 05:06

0 Answers0