Lloyd R. Prentice
Lloyd R. Prentice

Reputation: 4837

Storing images with RethinkDB

I'm designing an application based on RethinkDB, which involves storing images.

Each entity that I wish to store involves a number of fields of text, numeric data and an image of several hundred kilobytes.

Would it be best to store the images in files with a cross reference in the JSON records? Or can they be stored in the JSON record itself? Should I consider another database scheme altogether?

Upvotes: 3

Views: 1256

Answers (1)

neumino
neumino

Reputation: 4353

It depends mostly of your load. The main things to consider is: - Storing everything in the same document make things faster to retrieve (no need to perform a join) - Storing everything in the same document means that for each update, the whole document has to be rewritten (this is because RethinkDB is schema-less).

So if you will often update your fields but not your file, you should probably store the images in different documents. If you are going to store once your document, and then just do reads, you are probably better saving everything in the same document.

Saving everything in the same document make also things easier from a developer point of view.

Upvotes: 2

Related Questions