MongoDB ODM: 用于电子商务的MongoDB

Doctrine - MongoDB ODM: MongoDB for eCommerce

本案例以一个T-Shirt为模型,展示了MongoDB在电子商务行业应用,衬衫有大中号型号,通过name-value形式保存MongoDB:


{
"_id": ObjectId("4bffd798fdc2120019040000")
"name": "Configurable T-Shirt"
"options": [
{
"name": "small",
"price": 12.99
},
{
"name": "medium",
"price": 15.99
},
{
"name": "large",
"price": 17.99
}
]
}

类似以前关系数据库中动态数据表,由用户自定义字段名,这种方式可带来很大灵活性,缺点是性能低,如果使用MongoDB这样NoSQL,估计能解决性能问题了。