MongoDB – Save Image as Bytes or Files

mongodb

I'm developing a website which allows the user to upload an image per item. I guess there will be hundreds per user.

What is more preferred?

Save the images:

  • as bytes in the DB (mongodb)
  • as files in the server

I don`t really know where to place this question in the "Stack Exchange" forums.

Best Answer

People have tested data vs. file storage for this sort of thing (you can see the full details of a test here.

Per this test, for performance reasons, the file system is the best option for production.