Small Data Types

We have to store data representing a collection that at worse case can contain more than a few million items.

We need to store an array of ids.

Ideally, we’d like to have the collections map to single documents.

How many bytes will couchbase use to represent an integer, assuming that no integer will be larger than that which can be represented by 32 bits.

And can we rely on this type of assumption?


I am testing using a single field document like this:
{a: int}
here are my results when querying in the cb query ui:
(int, byteSize)
1, 1
32768, 5
1e9, 10

Is there any other way to compactly represent number on documents?