Knowledgebase

Firestore Data Modelling Print

  • googletechnology, google, woocommerce, restore, database, billing, guide, howto
  • 0

Structuring document data.

WHAT IT IS

A document database, with collections containing documents, which may contain subcollections.

WHAT DIFFERS FROM RELATIONAL THINKING

No joins Queries must be supported by an index Structure follows how you read, not how you store

WHAT THAT MEANS

Model for your queries, not for normalisation.

WHAT DENORMALISATION MEANS HERE

Duplicating data so a screen can be rendered from one read.

WHY THAT IS ACCEPTABLE

Reads are billed, and joins do not exist, so fewer reads is the objective.

WHAT IT COSTS

Keeping duplicates consistent when the source changes.

WHAT TO USE FOR THAT

Server-side functions updating duplicates on change.

WHAT TO AVOID

Very large documents Collections where you must read everything to answer a question Unbounded arrays within documents

WHAT TO KNOW ABOUT BILLING

You are billed per document read, written and deleted.

WHAT THAT MEANS

A screen reading hundreds of documents costs accordingly, every time it opens.

WHAT TO DESIGN FOR

Few reads per screen.

WHAT TO USE FOR COUNTS AND AGGREGATES

Maintained counters, or the aggregation queries where they suffice.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot