My database in Firebase currently looks like this:
locations: {
person: ""
location: ""
}
locations: {
person: "" {
location: ""
}
}
let locRef = locationRef.childByAutoId()
let locItem = [
"location": getLocation(),
"person": senderId
]
locRef.setValue(locItem)
let locRef = locationRef.childByAutoId()
let locItem = [
senderId : [
"location": getLocationID()
]
]
SenderID will be the key for the person, so you can find the Person by its ID... And the ID is holding a nested location key
Do you only need the logic? Or do you need working code example?