2

Im looking to create an app to list all shops, bars, etc that are into my town. I want to have the ability of querying to get all the places that are open right now.

For example:

The baropen on monday at 9:00 and close at 22:00 but on thuesday they close up at 21:00. But on Wednesday they open at 9:00 close at 13:00 open again at 15:00 and keep its bar open untill 00:00.

The point is that I cannot figure out how to retrieve the bars that are open given a time (for example the current time). In SQL I would have a table with opening and closing times, and make a query like this one

SELECT DISTINCT id FROM OpeningTimes WHERE opening >= "17:00" and closing <= "17:00";

And do a Inner Join with that query and the table with the data to show into the screen.

Is there any way to do that in Firebase? I think the trick may come in the way I have to store the information but I cannot figure it out.

Thank you very much, and sorry about my english.

  • Possible duplicate of [Query based on multiple where clauses in Firebase](https://stackoverflow.com/questions/26700924/query-based-on-multiple-where-clauses-in-firebase) – André Kool Jan 12 '19 at 14:05
  • In this case the query won't be possible, even with a synthetic `"opening_closing": "0900_1700"` property, since you can only filter by range on the last value in that. So you'll have to filter on one property server-side and do the other client-side. – Frank van Puffelen Jan 12 '19 at 15:18

0 Answers0