DEV Community

Cover image for Firebase limits doc fields
Drew Ronsman
Drew Ronsman

Posted on

Firebase limits doc fields

Today I ill be figuring out the max amount of items a single firestore doc can have and why that is a problem.

The problem

We all know how limiting firestore is, but don't get me wrong the developer experience is amazing just plop down some functions to create read and update data it's super easy and simple.

Firestore sucks at relational data at scale. One way to represent relationships is having other document ids and embed it into the document, but truly how many document ids can fit into one document.

Image description

The answer is that each firestore document can have at max 19999 different items in a document after that many items adding anything else does not work.

You might ask who would need that many items in a single document. Well features like followers where you grab the others user uid to show a follower and followee relationship is impossible unless you add more documents to show the relationship where it could check first document then second document with a list of uids. But that is clunky and doesn't work well.

So unless the firebase team can do something better for relational data firestore is an inadequate option for large scale relational data.

Top comments (0)