How to retrieve all data from a subcollection of all document #6880
Unanswered
VincentCauch
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am using flutter for my app, I want to retrieve all document (not only for one user) of a subcollection and display in the app. This is how I store in firebase:
String createAt = DateTime.now().millisecondsSinceEpoch.toString();
var ref = FirebaseFirestore.instance
.collection('Trips')
.doc('userId')
.collection('Baggage')
.doc(createAt);
FirebaseFirestore.instance.runTransaction((transaction) async {
transaction.set(ref, {
'departure': city1.text
'destination': city2.text
'weight': _weightcontroller.text,
'id': userId,
'departureDate': date.text,
'username': firstname,
"timestamp": createAt,
});
});
I also have subcollection Cars:
var ref1 = FirebaseFirestore.instance
.collection('Trips')
.doc('userId')
.collection('Cars')
.doc(createAt);
How to retrieve data from subcollection 'Baggage' for all users
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions