I will implement something like VKontakte wall - posts, text, attachments ... For storing the post I created a class with a designer and heteras. The question is: is it possible to save the post with one line in the database using serialize (), and how is it wrong?
- oneApproximately 95% wrong. There are situations with the need to store data in an unstructured form, but this is not one of them, and it is better to save in something that will be easily readable by any platform (json / protobuf / less convenient options) - etki
- oneIn principle, it is possible, but at the same time you generally lose all the benefits of using the database. You will not be able to filter the request by time / author / something else, you will not be able to make conscious changes to it (edited then for example), you will not be able to build normal response trees, etc. - rjhdby
- oneDo you want to serialize the post itself and its meta data? And what is the deep meaning of this? - br3t
- If you are using the current version of postgress or mysql, you can store a json object in a json type field. But think about whether you need filters when sampling and sorting? Much more convenient to use the standard approach. If mongoDB is used, then only json :) - ilyaplot
|