I created the structure below on firebase and I need to get the auto id underlined in red:
The code I created to query the values:
let query = reference.queryOrdered(byChild: "receiverId").queryEqual(toValue: "LKupL7KYiedpr6uEizdCapezJ6i2")
//Start process
query.observe(.value, with: { (snapshot) in
guard snapshot.exists() else{
print("Data doesn't exists")
return
}
print(snapshot.key)
}
My "snapshot.value" results in:
Optional({
"-KaRVjQgfFD00GXurK9m" = {
receiverId = LKupL7KYiedpr6uEizdCapezJ6i2;
senderId = bS6JPkEDXIVrlYtSeQQgOjCNTii1;
timestamp = 1484389589738;
};
})
How do I get only the string -KaRVjQgfFD00GXurK9m from the node above?
I had tried using "print(snapshot.key)" but it results on the user ID: bS6JPkEDXIVrlYtSeQQgOjCNTii1
Some ideas? Thank you very much.