I have the data structure as shown in the images below. I have a manager logged in via Firebase Auth. Their data is stored in Firestore specific to their UID. Each manager is able to add multiple turfs & their each turf’s UID is stored in turfs_owned
as an array.
All the turfs created are stored in turfs
collection with their respective UID and a field designating which manager created that turf by defining the manager’s UID in the manager_id
field.
I want to fetch the details of each turf created by the manager who is currently logged in.
*I am developing an Android app using Kotlin.
manager collection
turf one created by the manager
turf two created by the manager
I don’t know how to fetch the data like this stored in a different collection which is mapped to a different collection.
I thought of comparing the UIDs (strings) stored in turfs_owned
with all the UIDs (strings) present in the turfs
collection and only showing the UIDs which match and fetch the data of each turf in a separate Card View but I don’t know how to implement this in Kotlin!
Please help!
Soumil Jaiswal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.