I´m trying to get data from Firebase depending on the name and city from object. My firebase tree looks like this:
MYAPP
Object:
- 12837291ß2837(a random ID):
"name": "test"
"city": "Hong Kong"
- 12382133193u2:
"name": "test"
"city": "Paris"
- 2137829128738:
"name": "test2"
"city": "Frankfurt"
So for example i just want to get the Object where the name is "test" and the city is "Hong Kong".
i tried sth like this but i dont get any Data:
let ref = FIRDatabase.database().referenceFromURL("https://myRef")
ref.queryOrderedByChild("Object").queryEqualToValue("test").observeEventType(.ChildAdded) { (snapshot) in
print(snapshot)
}
I also added rules in Firebase like :
".indexOn": "Object"