Reputation: 67
I have on collection name > User doc id > sub collection > auto id > some data.
I need to retrieve my "some data". I tried my below code. But i am not getting the exact data available in my each auto generated id
var location: [DocumentSnapshot] = []
This is the method i used :
Firestore.firestore().collection("Users").document("KWfMNamZ4dN0DfQppLl33Ng692F3").collection("Relations").getDocuments { (querySnapshot: QuerySnapshot?, error: Error?) in
if let error = error {
print(error.localizedDescription)
} else {
self.location = (querySnapshot?.documents)!
print(querySnapshot)
//[<FIRQueryDocumentSnapshot: 0x2803db100>, <FIRQueryDocumentSnapshot: 0x2803db1c0>]
print(self.location)
}
}
But when i print my query i am getting always :
[<FIRQueryDocumentSnapshot: 0x2803db100>, <FIRQueryDocumentSnapshot: 0x2803db1c0>]
I have one collection name called "Users". It have some "Uid". In that particular Uid i have one more sub collection called "Relations". This relations have an auto gen id with some data.
So totally i may have one or many auto gen id , each id have some data.So i needs to fetch that all data , not only auto gen id.
How can i achieve that.Any solution would be helpful
Thanks
Upvotes: 1
Views: 210