0

enter image description here

Please check the above screenshot. I have to filter the data from firebase realtime database.

The Real time database not supported multiple condition. I am trying to filter the data from json object but there are multiple filters.

Sometimes I will send 1 value, sometimes 2 or sometimes 6. I am used AND condition but that is not working.

Can you please suggest me something on how to filter data from json object with multiple condition in firebase?

Tim Martens
  • 1,464
  • 9
  • 18
  • Firebase Database queries can only order/filter on a single property. In many cases it is possible to combine the values you want to filter on into a single (synthetic) property. For an example of this and other approaches, see my answer here: http://stackoverflow.com/questions/26700924/query-based-on-multiple-where-clauses-in-firebase – Frank van Puffelen Aug 22 '18 at 13:18
  • Can not combine fields in single. is it possible to filter it from json object? – secureweb sunil Aug 23 '18 at 10:09
  • You mean in your client-side code? That is certainly possible, and mentioned as option 1 in the answer I linked. It means that you'll be downloading more data to the client than strictly needed though, which in general is considered an anti-pattern. If you want to allow your users to perform more complex searches, it is also not uncommon to use a third party search engine such as Elastic Search or (hosted) Algolia. See this blog post (or search for other integrations): https://firebase.googleblog.com/2014/01/queries-part-2-advanced-searches-with.html – Frank van Puffelen Aug 23 '18 at 14:06

0 Answers0