I am using firebase realtime db. I want to get data from firebase with react-firebase-hooks/database library.
I want to get users with certain ids. I know how can i get one user:
const user = useObjectVal(ref(myDB, "users/123")) // where id = 123
but what if i need users with id = 123 and id = 456? How can i get data for only two documents from firebase?
I just want something like this:
const user = useObjectVal(ref(myDB, "users/123&456")) // where id = 123
There is no way to perform an OR with multiple values in the Firebase Realtime Database API. You'll have to perform a separate query for each value and merge the results in your application code.
Also see my answer here: iOS - OR query in Firebase