I am new in using firebase as backend to my flutter app and I have a question how to link two documents together and get both data at same time for example I have a user collection and post collection how I link both and when I get post data I also get user data in the same response
Asked
Active
Viewed 122 times
1 Answers
1
Your objective looks like a JOIN
query in a SQL database. Unfortunately, there is no JOIN
query in Firestore - a NoSQL database. It is also mentioned in this answer that Firestore does not have the concept of a server-side JOIN.
There are ways that you can still do it like the following answers below:
- number one: You will have to query them individually then combine the two documents or to get data from multiple collections, you will need to perform multiple read operations. I think these are some examples of it: 1 2 3.
- number two: Remodeling your database that you can perform a Collection group query.

JM Gelilio
- 3,482
- 1
- 11
- 23
-
from what you say i guess that's not the optimal solution for social media – Mohamed Eldereny Feb 20 '21 at 01:34