1 | initial version |
To create a collection within a collection in a Flutter document, you can follow these steps:
final DocumentReference parentDocRef = Firestore.instance.collection('parentCollection').document('parentDocId');
final CollectionReference childCollectionRef = parentDocRef.collection('childCollection');
childCollectionRef.add({'field1': 'value1', 'field2': 'value2'});
childCollectionRef.getDocuments().then((QuerySnapshot snapshot) {
snapshot.documents.forEach((DocumentSnapshot document) {
// process document data
});
});