I want to look through Firebase and check if a certain value for a child exists and if that value does not exist. I want to print out a statement
databaseRef.child("books").queryOrdered(byChild: "Category").queryEqual(toValue: categorySegue).observe(.childAdded, with: { (snapshot) in
if snapshot.exists() {
print("data found")
}else{
print("no data found")
}
})
When the child value exists, it prints out data found perfectly fine but when it does not exist. It does not print out no data found