Performing OR Queries in Firebase Cloud Firestore for JavaScript with RxJS

Lim Shang Yi
Google Developer Experts

--

Edit: This article was written wayyy before RxFire came into existence. I published another article that makes doing this much simplier with RxFire. Check it out here. I I would recommend you to read further if you are interested with solving this problem with just RxJS.

Cloud Firestore is one of the latest features offered by Firebase which lets you store data easily for your apps. Compared to the Firebase Realtime database, the Firestore provides powerful and easy query functionalities to get the data you need. In the Firebase’s documentation we see excellent examples of how we can query data from the Firestore. However, after using it for some time in my own projects, there seems to be something that’s obviously missing — the ability to query with a logical OR.

In one of my projects, I would like to query documents of different statuses, and show them in the UI. We could of course have multiple queries and bind them separately to the UI as follows:

JavaScript

--

--

Lim Shang Yi
Google Developer Experts

Google Developer Expert Firebase. Loves everything technology