How to Query a Document Reference that is stored in a Subcollection

Database & APIs

I am creating a social-media type App where users can like posts and on a page see a list of all their liked posts, displaying the post photo and name. When a user likes a post, a new document is created in the user subcollection (likedPosts) which stores the time stamp and post reference. The post document is also updated where a list of user references is stored to keep track of who liked the post os the number of likes.

I am trying to display a list of post that the user has liked. I have been able to do this by querying post documents and filtering if it contains the user reference in the list of likes. This works, however, the list cannot be sorted by time liked, only time posted.

Therefore, I am trying to query all documents in the likedPost subcollection where each document contains the time stamp and post document. The problem I am having is that I cannot then display or query only the post references that are contained in this likedPost document.

Is there a way to do this?

What have you tried so far?

I have tried finding similar posts and youtube videos. I have also tried generating dynamic children.

Did you check FlutterFlow's Documentation for this topic?
Yes
1
1 reply