问题
If I have a map saved in a document in Firestore, for example:
aMap: {
exampleKey1: 'value',
}
does that come to...
- 5 bytes, Map name
- 12 bytes, sum of each field name
- 6 bytes, sum of each field value
...Then according to https://firebase.google.com/docs/firestore/storage-size a 'Map' storage size is calculated the same as document size, which includes 32 additional bytes, and document name adds an extra 16 bytes.
Do Maps incur theses additional bytes like documents do?
回答1:
The docs states:
The size of the map calculated the same way as document size.
Meaning that you need to add those 32 additional bytes when you calculate the size of the content of a Map. However, the other 16 bytes should not be calculated. This is because those 16 bytes are referring to the document name and in this case, there is no document name, there is a Map name, which is calculated as the length of the name plus 1 byte. In your case, 5 bytes.
For Android, there is a library that can help you calculate the exact size of the document:
- FirestoreDocument-Android
来源:https://stackoverflow.com/questions/61549638/firebase-firestore-map-storage-size