Maximum size of byte array in Realm cloud

Hello,

i want to save documents in realm and want to use byte arrays for this. i can´t find informations on the maximum size of such byte arrays in realm in the cloud instance at the documentation.

can anyone help me?

best regards

Volkhard

2 Likes

Hello Volkhard_Vogeler

Here is the documentation:
https://docs.mongodb.com/manual/reference/limits/

To know what size a document is we can do this:

Object.bsonsize(db.persons.find({"“name”: “Federico Ettlin”}))

Regards

1 Like

For realm, the max size is 16Mb for Data and String properties.

NSData and NSString properties cannot hold data exceeding 16MB in size. To store larger amounts of data, either break it up into 16MB chunks or store it directly on the file system, storing paths to these files in the Realm. An exception will be thrown at runtime if your app attempts to store more than 16MB in a single property.

The Realm documentation is here

Keep in mind that Realm discourages L A R G E files to be stored in realm - you would be better off storing them in another source, such as Firebase Storage and keeping a link in realm.

To avoid size limitations and a performance impact, it is best not to store large blobs (such as image and video files) directly in Realm

3 Likes

Do you know, if the limit is 16 * 1,000,000B or 16 * 1,048,576B?

I would guess that it would be 16MB (bytes), a multiple of a single byte. So it would be most accuratelty represented by 1,048,576. (1,048,576 being 1 Megabyte in computer-ese or 2^20 bytes)

It is 16 MB currently. If you want to store something bigger than that you will need to split it into multiple chuncks (fields).

if you’re interested learn MongoDB go through it