I got a collection users/$userID/followers
this user ID is the firebase UID so is 29 bytes long ( String sizes are calculated as the number of UTF-8 encoded bytes + 1.)
Inside each user document i got a array named followers and another named following. Both arrays contain a lot of userID's so here's the problem.
In firestore each document has a max size of 1mb so it's easy to see I'm gonna run out of space soon. My question is what's the best way to manage large arrays like this ones.
Most obvious option: Create another document, containing just a pair of new arrays to continue saving this data ( and do this in a recursive way when the limit of the document is reached).
So some better idea? Or at least how to simplify the process a little bit.
More info about size limits here: https://firebase.google.com/docs/firestore/storage-size?hl=en-419
If you're concerned about the size of an array, you should instead split each item out of the array and make it its own document. This is the only way you will achieve massive scalability with Firestore for storing many individual items.
Yes, it will cost more. There is a cost to scalability.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With