If a field in the Mongo database is a JSON object, is it better to store it directly as an object or to serialize it into a string and store it again? what are the advantages and disadvantages of the two methods and are they applicable to the scene? Is there any difference in performance and space size? Why?
If there is a query requirement (or potential query requirement) for the fields in this object, it is obviously better to store it as an object, because there is no way to query strings at all.
In terms of writing efficiency, objects will eventually be serialized into BSON, which is usually smaller than JSON, so writing strings on it has no advantage.
In various scenarios, I only think that serialization and deserialization of objects will take more time than strings. But then again, since it is JSON, even if it is not serialized and deserialized at the driver level, it will definitely be completed somewhere else, so there is actually no difference.
In a word, objects are superior to strings in all aspects.