Is it OK to store HTML in MongoDB? Are there disadvantages? Are there better alternatives?
I'm a bit new to JSON, but I'm planning migrate my WordPress site to a custom meteor/mongodb site.
In WordPress our "Posts" are essentially product records, and the "main content" is the product's description. These descriptions contain some HTML markup, such as "strong" tags, break tags, and href hyperlinks.
<p>Who hasn't wished for a mini-Roomba to handle the arduous task of cleaning their iPhone screen? Now your dreams have come true! See the Takara web page for a <a href="http://www.takaratomy.co.jp/products/automee/" title="automee s" target="_blank">demo video.</a><strong>Colors: </strong> White, Red, Orange and Blue Runs on a single AA battery.<br> 1,575 yen</p>
Unlike XML, JSON lacks something like CDATA. Is it a bad idea to try and put HTML in my JSON-style doc description field? Are there special escape characters for doing this? Or should I store the HTML product description as a external, static file? Or are there other best practices?
{
'_id':'236',
'name':'Tokyo Marui M9A1 Gas Blow Back Airsoft Gun',
'description':'<p>html here?</p>',
'tags': ['toys','outdoors']
...
}
Any tip, advice, links appreciated!
EDIT
Sample product description text added.
EDIT2
I found this stackoverflow article: How to store HTML data in MongoDB?
and another on google https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/HW5XB5yox20
They seem to say it should be fine. But there isn't much discussion, so just seeking more confirmation.
Edit3
additional reference https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/0m8KJ7mPWiQ