CrossRider - Is there a limit on the size of objects which are saved to the local database?

68 views Asked by At

We have an object which is downloaded from http://jsons.[part_of_link_suppressed].com.s3.amazonaws.com/selectors.json. We tried to save it to the local database, but nothing is saved. I checked and if I save a small object then it's saved to the database. Is there a limit on the size of objects which are saved to the local database? And if there is, what is the limit? Do we have to divide objects to small objects if we want to save them to the local database? And how do we divide arbitrary objects to small objects and save them to the database?

Edit: I refer to the synchronous database with the appAPI.db API.

1

There are 1 answers

6
Bnaya On

I'm not sure which crossrider db api your are using, but all of their storage apis have some size limitations. the file you linked to ain't big so i guess you are using the appAPI.db

The appAPI.db is very limited, as their current docs say:

Use this method to save integers, booleans, short strings of approximately 10 characters, and simple objects containing the aforementioned types. If you need to save larger amounts of data, use appAPI.db.async. While the overall size limit of all entries is 5MB http://docs.crossrider.com/#!/api/appAPI.db

With appAPI.db.async the limit is 1MB per key, 50MB total - that should do the work for you. You can use their built it method to save remote resources to the async db: appAPI.db.async.setFromRemote

http://docs.crossrider.com/#!/api/appAPI.db.async

If you want to save even more space, you can serve your json string without linebreaks and spaces (minified/none pretty printed), or you can do it on the clientside before saving it to the db (JSON.parse then stringify it again). Its very possible crossrider are doing it internally when you save js object and not string.