Has anyone have any luck using the function:
.queryEqualToValue(value: AnyObject?, childKey: String?)
Two things:
1) The childKey
The following is written in the Firebase documentation:
queryEqualToValue Return items equal to the specified key, value, or priority, depending on the order-by method chosen.
Retrieve Data on iOS
The important part is: "depending on the order-by method chosen."
So make sure, you combine the queryEqualToValue-Method with a orderBy-Method.
For example:
let groupState = "open"
ref.child("groups").queryOrdered(byChild:"state").queryEqual(toValue:groupState).observe(enventType: .value, with: { snapshot in
// Returns all groups with state "open"
for group in snapshot.children {
print(group)
}
})
PS: The variant with childKey is not mentioned in the new Firebase iOS-Guides.