Pathis Patel
Pathis Patel

Reputation: 179

What are the sizes for numbers in Firestore?

I checked the storage size but I'm confused when it comes to storing numbers.

  1. In case of Bytes, what does "Byte length" mean? If I store -128 what's the length? And in case of 12?

  2. In case of Floating-point number and Integer, it doesn't matter if I store 325 or 9.9999999999999 it will always be 8 bytes?

  3. In case of Array? Let' say we have ["ab", "bcd"], what's the size, (2+3=5) or (2+1)+(3+1)=7

Upvotes: 0

Views: 293

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317362

  1. If you store an array of bytes, the size will simply be the length of that array. An array with a single byte value of -128 is still just one byte.

  2. Yes, all numbers occupy the same 8-byte size, even if you don't see a fractional part.

  3. The documentation says it's the sum of the array element sizes, so I would expect 7, the sum of the two individual string sizes, each encoded in UTF-8 + 1

Upvotes: 1

Related Questions