0

I essentially want to show a list of jobs and the companies that they are associated with within a single list with firestore

My current DB set-up looks like this.

enter image description here

So if I want to show the job description alongside the company details I currently have two options

  1. Copy the relevant company details to each job post

Which would make me update every single job post every time the parent data changes.

  1. For each subcollection query I do an additional query to get the parent data info.

Which feels a lot cleaner but could end up a lot more expensive, since the job list is the data that will be retrieved the most often

What DB structure would be the most optimal in this scenario?

Thanks!

Markwin
  • 177
  • 2
  • 16
  • 2
    You've already given us all the right considerations, so I really think *you* are in the best position to make the call here. The fact that *I* tend to prefer duplicating the data, doesn't mean that you have to do that too. Both approaches can work, and neither approach is pertinently better than the other here. – Frank van Puffelen Jan 12 '22 at 00:10
  • You might also check this [answer](https://stackoverflow.com/questions/53053768/what-is-the-correct-way-to-structure-this-kind-of-data-in-firestore) out. – Alex Mamo Jan 12 '22 at 08:44

0 Answers0