Firebase ios select from database where value equals to something

227 views Asked by At

I have a firebase database and want to get the values from the DB into swift but I need to filter the data as I have 2 types of data Inc and Exp how can I create a query for Firebase that will select all the fields where Type = Exp for example

Here is how my DB looks like

enter image description here

1

There are 1 answers

0
Daniel Medina Sada On

if you get your response from firebase as an Array, you can do

response = response.filter({yourItem.type == "Exp"})