Reputation: 900
i use cloud firestore in flutter and i have this structure
collections > documents > sub-collections > sub-documents
in my cloud
=> collections (users)
=> documents (user_id)
=> sub-collections (Video)
=> sub-documents (video_id)
i want to listen to all sub-collections in the documents (user_id) without specify the user_id
like that
Firestore.instance.collection('users').document(*).collection('Video').snapshots().listen((data)
Upvotes: 0
Views: 1294
Reputation: 598728
If you want to listen to a specific (named) collection across the entire database, you can perform a so-called Collection Group Query. See the documentation on these queries for an example.
In Flutter this would look something like:
Firestore.instance.collectionGroup('Video').snapshots().listen((data)
This will listen to all Video
collections, not just the ones under users
though.
Upvotes: 2