Because Firebase is a NoSQL database, there is no WHERE
clause that sounds like this:
SELECT * FROM Video WHERE lang='en' OR lang='zh'
Unfortunately, Firebase does not allow multiple queries that can serve your purpose. What can you do instead is to use an ordering query which is equal to the desired language on the same reference
twice. These queries should look like this:
.yourRef.orderByChild("lang").equalTo("en");
.yourRef.orderByChild("lang").equalTo("zh");
Now, you can combine the result of both queries and display them on the user side. If you need to query against your database by more then two languages then I suggest you change the structure of your database a little bit. You'll need to create another node named languages
in which you can add the available videos for each particular language. The new structure should look like this:
Firebase-root
|
--- languages
|
--- en
| |
| --- video1: true
|
--- zh
| |
| --- video2: true
|
--- fi
|
--- video3: true
|
--- video4: true
In this way, you can add a listener to the desired language and see all the available videos. As Frank said, it will be even faster than normal queries.