Max*_*ges 42 json mongodb meteor
可以在MongoDB中存储HTML吗?有缺点吗?还有更好的选择吗?
我对JSON有点新鲜,但我计划将我的WordPress站点迁移到自定义的meteor/mongodb站点.
在WordPress中,我们的"帖子"基本上是产品记录,"主要内容"是产品的描述.这些描述包含一些HTML标记,例如"强"标记,中断标记和href超链接.
<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>
与XML不同,JSON缺少像CDATA这样的东西.尝试将HTML放在我的JSON样式的doc描述字段中是一个坏主意吗?这样做有特殊的逃脱角色吗?或者我应该将HTML产品描述存储为外部静态文件?还是有其他最佳做法?
{
'_id':'236',
'name':'Tokyo Marui M9A1 Gas Blow Back Airsoft Gun',
'description':'<p>html here?</p>',
'tags': ['toys','outdoors']
...
}
任何提示,建议,链接赞赏!
编辑
添加了示例产品说明文字.
EDIT2
我找到了这个stackoverflow文章: 如何在MongoDB中存储HTML数据?
另一个在谷歌 https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/HW5XB5yox20
他们似乎说应该没事.但是没有太多的讨论,所以只是寻求更多的确认.
EDIT3
其他参考 https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/0m8KJ7mPWiQ
Max*_*ges 22
好吧,我似乎找到了足够的文章来总结:
将MongoDB中的html片段和文件存储为标准的utf-8编码字符串是完全没问题的,但有一些注意事项:http: //docs.mongodb.org/manual/faq/developers/#when-should-i-use-gridfs