Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What is the maximum depth of a Map field in Firestore?

I am using a Map field to store all the medical aid IDs of a member. I don’t want to use a subcollection because its maximum depth is only 100. The medical aid of a member can reach more than 100.

Here is an example of my map field:

medicalAids:{ id1: true, id2: true, id3: true}

How many ids I can store in this medicalAids (map)?
Should I use subcollection instead?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

What you’re describing isn’t called "depth". That’s simply the number of nested map fields. You can have as many map fields as you want, up to the max size of a document, which is 1MB. Learn how to calculate the size of a document using the documentation.

Subcollections are not limited in number of documents. The max subcollection depth you’re referring to is talking about nested subcollections, not number of documents. If you have an unbounded number of items to store, you should definitely do that using documents in a subcollection, not a map field, because you will run out of that 1MB space.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading