Home > Software engineering >  Whats the best way to structure Firestore database?
Whats the best way to structure Firestore database?

Time:08-14

For scalability, minimal reads & writes, and avoid usage limits. This is my approach for a blog-like project, any suggestions for improvements?

enter image description here

CodePudding user response:

It's good to hear that the following structure:

Answers your question, but regarding:

Do I get fewer reads & writes if you structure your database with more sub-collections/documents like the image above?

No, it doesn't really matter if you query a collection or a sub-collection, you'll always have to pay a number of reads that is equal to the number of documents that are returned.

Also which of the two options can reach usage limits faster?

The structure doesn't matter. What it really matters is the number of requests you perform.

  • Related