lundi 6 janvier 2020

Fetch documents from multiple subcollections - Firebase

I'm creating a web app for admin with firebase integration, this web app is used by admin to monitor posts or comments posted by user from Android or iOS app developed in ionic. I'm using Firebase firestore, and following is the database design posts/{postsDocument}/comments/{commentsDocument} Comments is sub-collection for postsDocument which holds all the comments for a particular post. Also postDocument and commentsDocument contains Firebase uid of the user.

My problem is, whether it's possible to fetch all the comments commented by a particular user, i can query a single collection, but in this scenario commentsDocument is a subcollection and i want to fetch all comments across all the post by a user for monitoring purpose.




Aucun commentaire:

Enregistrer un commentaire