This is a follow up question to Firebase - proper way to structure the DB
I have the following DB structure:
\"artists\" : {
\"-KKMkpA22PeoHtBAPyKm
Here's a solution.
let ref = self.myRootRef.childByAppendingPath("artists")
ref.queryOrderedByChild("name").queryEqualToValue("Skillet")
.observeEventType(.Value, withBlock: { snapshot in
if ( snapshot.value is NSNull ) {
print("Skillet was not found")
} else {
for child in snapshot.children { //in case there are several skillets
let key = child.key as String
print(key)
}
}
})