Saving images with RethinkDB

I am developing a RethinkDB based application that includes image storage.

Each entity I want to store includes several fields of text, numeric data, and an image of several hundred kilobytes.

Would it be better to store images in cross-referenced files in JSON records? Or can they be stored in the JSON record itself? Should I consider a different database schema at all?

+3


source to share


1 answer


It mainly depends on your load. Key points to consider: - Saving everything in one document allows for faster recovery (no need to make a connection) - Saving everything in one document means that for every update the entire document has to be rewritten (this is because RethinkDB has no schema).

So, if you update your fields frequently, but not the file, you should probably keep the images in different documents. If you're going to store the document right away and then just read it, you're probably better off keeping everything in one document.



Keeping everything in one document makes things easier from a developer's point of view.

+3


source







All Articles