0

I have the following problem: I have a list of nearby places provided by the Google Places API and a Firebase db containing ratings for many places matched by their places_id. Now, I want to get the ratings from my Firebase for the according nearby places. Is there any way to combine or optimize these individual queries instead of querying every single places_id in a for-loop?

Thanks in advance.

finke
  • 3
  • 1
  • If I understand you correctly, you want to query on multiple properties. If that's the case, see http://stackoverflow.com/questions/26700924/query-based-on-multiple-where-clauses-in-firebase – Frank van Puffelen Apr 30 '16 at 14:10
  • @FrankvanPuffelen No, I don't want to query on multiple properties. I want to query on multiple values of one property, let's say I have an array of IDs: `arr = [1263, 3264, 3286]` Then I want to query all objects having one of the IDs in the array. Since the array's length can be up to 60, it surely isn't efficient to query 60 times on one ID. I'm looking for a better way. – finke Apr 30 '16 at 14:18
  • While semantically different, for Firebase those are the same things. You can only filter on one value. The solution (as almost always) is to structure your data in a way that allows the query you want. See the answer I linked earlier and many of my other recent answers. I also highly recommend reading this article about [NoSQL data modeling](https://highlyscalable.wordpress.com/2012/03/01/nosql-data-modeling-techniques/). – Frank van Puffelen Apr 30 '16 at 14:52

0 Answers0