MongoDB, a way to save formatted text with images for a blogging application

I need to implement a blogging application using .NET and MongoDB. What is the correct way to store posts / articles on blogs that people write? Suppose the user clicks the "New Record" button, then writes the text (which may contain images and links), and when everything is ready, he clicks the "Save" button. Thus, we somehow formatted the text mixed with images / videos / links to other resources, etc. How to keep blog posts? Is it right to save html directly in the database?

+4
source share
1 answer

Is it right to save html directly in the database?

Yes, of course, why not?

I believe that one of the problems you may get is that if people use encoded images in the base 64, they can exceed the maximum size of the document. This can cause problems.

In terms of the text there should be no problems, 4 MB is large enough for all of Shakespeare's work with some remaining.

One suggestion if you allow such things is to actually use GridFS to store the content of the blog itself, breaking the content into more (less than 16 MB in size) fragments.

- , , , CDN - HTML.

, , HTML .

+2

Source: https://habr.com/ru/post/1533948/