Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is a good strategy to store HTML in MongodDB JSON-style doc
    primarykey
    data
    text
    <p>Is it OK to store HTML in MongoDB? Are there disadvantages? Are there better alternatives?</p> <p>I'm a bit new to JSON, but I'm planning migrate my WordPress site to a custom meteor/mongodb site.</p> <p>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> <pre><code>&lt;p&gt;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 &lt;a href="http://www.takaratomy.co.jp/products/automee/" title="automee s" target="_blank"&gt;demo video.&lt;/a&gt;&lt;strong&gt;Colors: &lt;/strong&gt; White, Red, Orange and Blue Runs on a single AA battery.&lt;br&gt; 1,575 yen&lt;/p&gt; </code></pre> <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? </p> <pre><code>{ '_id':'236', 'name':'Tokyo Marui M9A1 Gas Blow Back Airsoft Gun', 'description':'&lt;p&gt;html here?&lt;/p&gt;', 'tags': ['toys','outdoors'] ... } </code></pre> <p>Any tip, advice, links appreciated! </p> <p><strong>EDIT</strong></p> <p>Sample product description text added.</p> <p><strong>EDIT2</strong></p> <p>I found this stackoverflow article: <a href="https://stackoverflow.com/questions/12139656/how-to-store-html-data-in-mongodb">How to store HTML data in MongoDB?</a></p> <p>and another on google <a href="https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/HW5XB5yox20" rel="noreferrer">https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/HW5XB5yox20</a></p> <p>They seem to say it should be fine. But there isn't much discussion, so just seeking more confirmation.</p> <p><strong>Edit3</strong></p> <p>additional reference <a href="https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/0m8KJ7mPWiQ" rel="noreferrer">https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/0m8KJ7mPWiQ</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload