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

How to calculate the size of a map field inside a Firestore document?

I have this map field in a Firestore document:

enter image description here

That exists at this location:

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

users/jeff/tasks/my_task_id

According to the docs, to calculate the size of the document I need:

  • The document name size = 6 + 5 + 6 + 11 + 16 = 44
  • The sum of the string size of each field name = 4
  • The sum of the size of each field value = 3 + 3 + 3 + 3 = 12
  • 32 additional bytes = 32

So the total should be: 92, right?

However, according to the same docs, it is said that in case of maps:

The size of the map, calculated the same way as document size.

Does this means, that besides the sum of the size of each field value, which is 12, should add again 44 and 32, since the map field is a Map, and it should be calculated exactly like the entire document? Or should I only add 32?

It’s quite confusing, please help.

>Solution :

Does this means, that besides the sum of the size of each field value, which is 12, should add again 44 and 32, since the map field is a Map, and it should be calculated exactly like the entire document? So it should be 168?

Yes, both the sizes of the field names and values contribute to the size of the map.

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