Histories
- Places
- ChIJ-REgsXyPwTARJh1vn16yZBc (placeID)
- name: "Tokyo Tower"
- userInfo
- M1nlb7iEg9ZU6cr28DOwJOqrlKA2 (userID)
- Lxqcl6Zys2cjmYSzcWU (autoID)
- dateAdded: "2020-01-05"
- interactionType: "placeTap"
let historiesPlacesRef = Database.database().reference().child("Histories").child("Places")
When I fetch the place with the name "Tokyo Tower" using the following, it works.
historiesPlacesRef
.queryOrdered(byChild: "name")
.queryEqual(toValue: "Tokyo Tower")
.observe(.value) { (dataSnapshot) in
print(dataSnapshot)
}
What I want to query is places that the current user visited. I tried the following. But it does not work.
historiesPlacesRef
.queryOrdered(byChild: "userInfo")
.queryEqual(toValue: Auth.auth().currentUser!.uid)
.observe(.value) { (dataSnapshot) in
print(dataSnapshot)
}