According to Cloud Firestore=>Data type Documentation, type reference act as foreign key in NoSQL world. but when I query it in Fluter/Dart.
Database in Firestore.
[Collection]
Note: DocumentOne's data type are all reference
- CollectionWithReference
- DocumentOne
- FKOne/doc001
- FKTwo/doc002
- DocumentOne
- FKOne
- doc001
- "someData": 'Just Some Data'
- doc001
- FKTwo
- doc002
- "anotherData": 'Just Another Data'
- doc002
Example Code:
Firestore.instance.collection('CollectionWithReference').snapshots()
.listen((data) => data.documents.forEach((document) => print(document.data)));
Output
{FKOne: Instance of 'DocumentReference', FKTwo: [Instance of 'DocumentReference', Instance of 'DocumentReference', Instance of 'DocumentReference']}