I\'m using the Realtime Database with Google\'s Firebase, and I\'m trying to check if a child exists.
My database is structured as the following
- /
While the answer of @ismael33 works, it downloads all the rooms to check if room1 exists.
The following code accomplishes the same, but then only downloads rooms/room1 to do so:
ref = FIRDatabase.database().reference()
ref.child("rooms/room1").observeSingleEvent(of: .value, with: { (snapshot) in
if snapshot.exists(){
print("true rooms exist")
}else{
print("false room doesn't exist")
}
})